public class Asserts extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
assertComparableSelf(Comparable xc)
Tests whether the first argument is equal to itself according
to
java.lang.Comparable.compareTo. |
static void |
assertComparableSelf(String msg,
Comparable xc)
Tests within a specified test case whether the first argument
is equal to itself according to
java.lang.Comparable.compareTo. |
static void |
assertEqualsArray(double[] xs,
double[] ys,
double tolerance)
Tests that the two specified arrays are not null, the same
length, and the element at each index is equal.
|
static void |
assertEqualsArray(String msg,
double[] xs,
double[] ys,
double tolerance)
Tests that the two specified arrays are not null, the same
length, and the element at each index is equal.
|
static void |
assertEqualsArray2D(double[][] xss,
double[][] yss,
double tolerance) |
static void |
assertEqualsIterations(Iterator it1,
Iterator it2)
Tests that the two iterators return the same elements as
compared by
#assertEquals(Object,Object). |
static void |
assertEqualsIterations(String msg,
Iterator it1,
Iterator it2)
Tests that the two iterators return the same elements as
compared by
#assertEquals(Object,Object), with the
specified error message. |
static void |
assertFullEquals(Object x,
Object y)
Asserts that two objects are equal and they obey the subsequent
requirements of the equality contract.
|
static void |
assertFullEquals(String msg,
Object x,
Object y)
Asserts within a specified test case that two objects are equal
and they obey the subsequent requirements of the equality
contract.
|
static void |
assertFullLessThan(Comparable x,
Comparable y)
Tests whether the first argument is less than the second argument according to
its
Comparable.compareTo method, and vice-versa. |
static void |
assertFullLessThan(String msg,
Comparable x,
Comparable y)
Tests within a specified test case whether the first argument
is less than the second argument according to its
Comparable.compareTo method, and vice-versa. |
static void |
assertFullNotEquals(Object x,
Object y)
Asserts that two objects are not equal and they obey the
subsequent reqirements of the equality contract.
|
static void |
assertFullNotEquals(String msg,
Object x,
Object y)
Asserts within a specified test case that two objects are not
equal and they obey the subsequent reqirements of the equality
contract.
|
static void |
assertFullSerialization(Object x)
Asserts that the object may be serialized and deserialized
and the result will be fully equal to this object in the
sense defined by
assertFullEquals(java.lang.Object, java.lang.Object). |
static void |
assertFullSerialization(String msg,
Object x)
Asserts within a specified test case that the object may be
serialized and deserialized and the result will be fully equal
to this object in the sense defined by
assertFullEquals(java.lang.Object, java.lang.Object). |
static <E> void |
assertLess(Comparator<? super E> comp,
E o1,
E o2) |
static void |
assertNotEquals(Object x,
Object y)
Asserts that the two specified objects are not
both
null and not both non-null
and equal. |
static void |
assertNotEquals(String msg,
Object x,
Object y)
Asserts that the two specified objects are not
both
null and not both non-null
and equal. |
static void |
assertNotSerializable(Object x) |
static <E> void |
assertSame(Comparator<? super E> comp,
E o1,
E o2) |
static void |
succeed()
Provides a test success with the default message.
|
static void |
succeed(String msg)
Provides a test success with the specified message for
this test case.
|
public static void assertNotSerializable(Object x)
public static void assertNotEquals(Object x, Object y)
null and not both non-null
and equal.x - First object to test.y - Second object to test.public static void assertNotEquals(String msg, Object x, Object y)
null and not both non-null
and equal.msg - Message to return for failure of assertion.x - First object to test.y - Second object to test.public static void assertEqualsArray(double[] xs,
double[] ys,
double tolerance)
xs - First array to test.ys - Second array to test.tolerance - Tolerance of double equality test.public static void assertEqualsArray2D(double[][] xss,
double[][] yss,
double tolerance)
public static void assertEqualsArray(String msg, double[] xs, double[] ys, double tolerance)
msg - Message to return if tests fial.xs - First array to test.ys - Second array to test.tolerance - Tolerance of double equality test.public static void assertFullEquals(Object x, Object y)
x.equals(y)
and y.equals(x). In addition, their hash codes
must be equivalent to pass this test.x - First object to test for equality.y - Second object to test for equality.public static void assertFullNotEquals(Object x, Object y)
!x.equals(y) and !y.equals(x). Note
that their hash codes may be equivalent.x - First object to test for inequality.y - Second object to test for inequality.public static void assertFullSerialization(Object x)
assertFullEquals(java.lang.Object, java.lang.Object).x - Object to test for serialization.public static void assertFullLessThan(Comparable x, Comparable y)
Comparable.compareTo method, and vice-versa. Also tests that the first
and second arguments are self-equal using the same method.x - Object that should be smaller.y - Object that should be bigger.public static void assertComparableSelf(Comparable xc)
java.lang.Comparable.compareTo. This also checks
that the comparable is not equal to a fresh object according to
this method, although a java.lang.ClassCastException is
allowed to be thrown.xc - Comparable to test for self equality and inequality
with fresh object.public static void assertEqualsIterations(Iterator it1, Iterator it2)
#assertEquals(Object,Object).it1 - First iterator.it2 - Second iterator.public static void assertEqualsIterations(String msg, Iterator it1, Iterator it2)
#assertEquals(Object,Object), with the
specified error message.msg - Message to report along with the location of the
difference.it1 - First iterator.it2 - Second iterator.public static void assertFullEquals(String msg, Object x, Object y)
x.equals(y) and
y.equals(x). In addition, their hash codes must
be equivalent to pass this test. Although recommend rather
than required by java.util.Comparable, if either object
is comparable, then its natural ordering is tested for
consistency with equals.msg - Message prefix to print upon failure.x - First object to test for equality.y - Second object to test for equality.public static void assertFullNotEquals(String msg, Object x, Object y)
!x.equals(y) and !y.equals(x). Note
that their hash codes may be equivalent. If either argument object
is an instance of Comparable then its comparison result
must also be non-zero against the other object.msg - Message prefix to print upon failure.x - First object to test for inequality.y - Second object to test for inequality.public static void assertFullSerialization(String msg, Object x)
assertFullEquals(java.lang.Object, java.lang.Object).msg - Message prefix to print upon failure.x - Object to test for serialization.public static void assertFullLessThan(String msg, Comparable x, Comparable y)
Comparable.compareTo method, and vice-versa. Also
tests that the first and second arguments are self-equal using
the same method.msg - Message prefix to print upon failure.x - Object that should be smaller.y - Object that should be bigger.public static void assertComparableSelf(String msg, Comparable xc)
java.lang.Comparable.compareTo. This also checks that the
comparable is not equal to a fresh object according to this
method, although a java.lang.ClassCastException is allowed to be thrown.msg - Message prefix to print upon failure.xc - Comparable to test for self equality and inequality with fresh object.public static void succeed()
public static void succeed(String msg)
msg - Message prefix to print on failure.public static <E> void assertLess(Comparator<? super E> comp, E o1, E o2)
E - type of objects being comparedpublic static <E> void assertSame(Comparator<? super E> comp, E o1, E o2)
E - type of objects being comparedCopyright © 2019 Alias-i, Inc.. All rights reserved.