java.lang.Object | |
↳ | android.test.MoreAsserts |
Contains additional assertion methods not found in JUnit.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Asserts that class
expected
is assignable from the class
actual
.
|
||||||||||
|
Asserts that the class
expected
is assignable from the object
actual
.
|
||||||||||
|
Variant of
assertContainsRegex(String, String, String)
using a
generic message.
|
||||||||||
|
Asserts that
expectedRegex
matches any substring of
actual
and fails with
message
if it does not.
|
||||||||||
|
Variant of assertContentsInAnyOrder(String, Iterable
?>
, Object...)
using a generic message.
|
||||||||||
|
Asserts that
actual
contains precisely the elements
expected
, but in any order.
|
||||||||||
|
Variant of assertContentsInOrder(String, Iterable
?>
, Object...)
using a generic message.
|
||||||||||
|
Asserts that
actual
contains precisely the elements
expected
, and in the same order.
|
||||||||||
|
Variant of
?>
)">assertEmpty(String, Iterable)
using a
generic message.
|
||||||||||
|
Asserts that
map
is empty.
|
||||||||||
|
Asserts that
iterable
is empty.
|
||||||||||
|
Variant of
, ??>
)">assertEmpty(String, Map)
using a generic
message.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that two sets contain the same elements.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that two sets contain the same elements.
|
||||||||||
|
Asserts that array
actual
is the same size and every element
is the same as those in array
expected
.
|
||||||||||
|
Asserts that array
actual
is the same size and every element
is the same as those in array
expected
.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that array
actual
is the same size and every element equals
those in array
expected
.
|
||||||||||
|
Asserts that
expectedRegex
exactly matches
actual
and
fails with
message
if it does not.
|
||||||||||
|
Variant of
assertMatchesRegex(String, String, String)
using a
generic message.
|
||||||||||
|
Asserts that
expectedRegex
does not match any substring of
actual
, and fails with
message
if it does.
|
||||||||||
|
Variant of
assertNotContainsRegex(String, String, String)
using a
generic message.
|
||||||||||
|
Variant of assertNotEmpty(String, Iterable
?>
)
using a generic message.
|
||||||||||
|
Variant of
, ??>
)">assertNotEmpty(String, Map)
using a generic
message.
|
||||||||||
|
Asserts that
map
is not empty.
|
||||||||||
|
Asserts that
iterable
is not empty.
|
||||||||||
|
Variant of
assertNotEqual(String, Object, Object)
using a
generic message.
|
||||||||||
|
|
||||||||||
|
Variant of
assertNotMatchesRegex(String, String, String)
using a
generic message.
|
||||||||||
|
Asserts that
expectedRegex
does not exactly match
actual
,
and fails with
message
if it does.
|
||||||||||
|
Utility for testing equals() and hashCode() results at once.
|
||||||||||
|
Variant of
checkEqualsAndHashCodeMethods(String,Object,Object,boolean...)}
using a generic message.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Asserts that class
expected
is assignable from the class
actual
. This verifies
expected
is a parent class or a
interface that
actual
implements.
Asserts that the class
expected
is assignable from the object
actual
. This verifies
expected
is a parent class or a
interface that
actual
implements.
Variant of
assertContainsRegex(String, String, String)
using a
generic message.
Asserts that
expectedRegex
matches any substring of
actual
and fails with
message
if it does not. The Matcher is returned in
case the test needs access to any captured groups. Note that you can also
use this for a literal string, by wrapping your expected string in
quote(String)
.
Variant of assertContentsInAnyOrder(String, Iterable ?> , Object...) using a generic message.
Asserts that
actual
contains precisely the elements
expected
, but in any order.
Variant of assertContentsInOrder(String, Iterable ?> , Object...) using a generic message.
Asserts that
actual
contains precisely the elements
expected
, and in the same order.
Variant of
?>
)">assertEmpty(String, Iterable)
using a
generic message.
Asserts that
map
is empty.
Asserts that
iterable
is empty.
Variant of
, ??>
)">assertEmpty(String, Map)
using a generic
message.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates first
specific element mismatch.
Asserts that two sets contain the same elements.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates specific
element mismatch.
Asserts that two sets contain the same elements.
Asserts that array
actual
is the same size and every element
is the same as those in array
expected
. Note that this uses
equals()
instead of
==
to compare the objects.
null
will be considered equal to
null
(unlike SQL).
On failure, message indicates first specific element mismatch.
Asserts that array
actual
is the same size and every element
is the same as those in array
expected
. Note that this uses
==
instead of
equals()
to compare the objects.
On failure, message indicates first specific element mismatch.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates first
specific element mismatch.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates first
specific element mismatch.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates first
specific element mismatch.
Asserts that array
actual
is the same size and every element equals
those in array
expected
. On failure, message indicates specific
element mismatch.
Asserts that
expectedRegex
exactly matches
actual
and
fails with
message
if it does not. The MatchResult is returned
in case the test needs access to any captured groups. Note that you can
also use this for a literal string, by wrapping your expected string in
quote(String)
.
Variant of
assertMatchesRegex(String, String, String)
using a
generic message.
Asserts that
expectedRegex
does not match any substring of
actual
, and fails with
message
if it does. Note that you
can also use this for a literal string, by wrapping your expected string
in
quote(String)
.
Variant of
assertNotContainsRegex(String, String, String)
using a
generic message.
Variant of assertNotEmpty(String, Iterable ?> ) using a generic message.
Variant of
, ??>
)">assertNotEmpty(String, Map)
using a generic
message.
Asserts that
map
is not empty.
Asserts that
iterable
is not empty.
Variant of
assertNotEqual(String, Object, Object)
using a
generic message.
Asserts that
actual
is not equal
unexpected
, according
to both
==
and
equals(Object)
.
Variant of
assertNotMatchesRegex(String, String, String)
using a
generic message.
Asserts that
expectedRegex
does not exactly match
actual
,
and fails with
message
if it does. Note that you can also use
this for a literal string, by wrapping your expected string in
quote(String)
.
Utility for testing equals() and hashCode() results at once. Tests that lhs.equals(rhs) matches expectedResult, as well as rhs.equals(lhs). Also tests that hashCode() return values are equal if expectedResult is true. (hashCode() is not tested if expectedResult is false, as unequal objects can have equal hashCodes.)
lhs | An Object for which equals() and hashCode() are to be tested. |
---|---|
rhs | As lhs. |
expectedResult | True if the objects should compare equal, false if not. |
Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean...)} using a generic message.