MoreAsserts
classMoreAsserts
kotlin.Any | |
↳ | android.test.MoreAsserts |
Contains additional assertion methods not found in JUnit.
Summary
Public methods | |
---|---|
static Unit |
assertAssignableFrom(expected: Class<*>!, actual: Class<*>!) Asserts that class |
static Unit |
assertAssignableFrom(expected: Class<*>!, actual: Any!) Asserts that the class |
static MatchResult! |
assertContainsRegex(expectedRegex: String!, actual: String!) Variant of |
static MatchResult! |
assertContainsRegex(message: String!, expectedRegex: String!, actual: String!) Asserts that |
static Unit |
assertContentsInAnyOrder(actual: MutableIterable<*>!, vararg expected: Any!) Variant of assertContentsInAnyOrder(String, Iterable, Object. |
static Unit |
assertContentsInAnyOrder(message: String!, actual: MutableIterable<*>!, vararg expected: Any!) Asserts that |
static Unit |
assertContentsInOrder(actual: MutableIterable<*>!, vararg expected: Any!) Variant of assertContentsInOrder(String, Iterable, Object. |
static Unit |
assertContentsInOrder(message: String!, actual: MutableIterable<*>!, vararg expected: Any!) Asserts that |
static Unit |
assertEmpty(iterable: MutableIterable<*>!) Variant of |
static Unit |
assertEmpty(message: String!, iterable: MutableIterable<*>!) Asserts that |
static Unit |
assertEmpty(message: String!, map: MutableMap<*, *>!) Asserts that |
static Unit |
assertEmpty(map: MutableMap<*, *>!) Variant of |
static Unit |
assertEquals(expected: ByteArray!, actual: ByteArray!) Asserts that array |
static Unit |
assertEquals(expected: DoubleArray!, actual: DoubleArray!) Asserts that array |
static Unit |
assertEquals(expected: IntArray!, actual: IntArray!) Asserts that array |
static Unit |
assertEquals(expected: Array<Any!>!, actual: Array<Any!>!) Asserts that array |
static Unit |
assertEquals(message: String!, expected: ByteArray!, actual: ByteArray!) Asserts that array |
static Unit |
assertEquals(message: String!, expected: DoubleArray!, actual: DoubleArray!) Asserts that array |
static Unit |
assertEquals(message: String!, expected: IntArray!, actual: IntArray!) Asserts that array |
static Unit |
Asserts that array |
static Unit |
assertEquals(message: String!, expected: MutableSet<*>!, actual: MutableSet<*>!) Asserts that two sets contain the same elements. |
static Unit |
assertEquals(expected: MutableSet<*>!, actual: MutableSet<*>!) Asserts that two sets contain the same elements. |
static MatchResult! |
assertMatchesRegex(expectedRegex: String!, actual: String!) Variant of |
static MatchResult! |
assertMatchesRegex(message: String!, expectedRegex: String!, actual: String!) Asserts that |
static Unit |
assertNotContainsRegex(expectedRegex: String!, actual: String!) Variant of |
static Unit |
assertNotContainsRegex(message: String!, expectedRegex: String!, actual: String!) Asserts that |
static Unit |
assertNotEmpty(iterable: MutableIterable<*>!) Variant of assertNotEmpty(String, Iterable) using a generic message. |
static Unit |
assertNotEmpty(message: String!, iterable: MutableIterable<*>!) Asserts that |
static Unit |
assertNotEmpty(message: String!, map: MutableMap<*, *>!) Asserts that |
static Unit |
assertNotEmpty(map: MutableMap<*, *>!) Variant of |
static Unit |
assertNotEqual(unexpected: Any!, actual: Any!) Variant of |
static Unit |
assertNotEqual(message: String!, unexpected: Any!, actual: Any!) Asserts that |
static Unit |
assertNotMatchesRegex(expectedRegex: String!, actual: String!) Variant of |
static Unit |
assertNotMatchesRegex(message: String!, expectedRegex: String!, actual: String!) Asserts that |
static Unit |
checkEqualsAndHashCodeMethods(lhs: Any!, rhs: Any!, expectedResult: Boolean) Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean...)} using a generic message. |
static Unit |
checkEqualsAndHashCodeMethods(message: String!, lhs: Any!, rhs: Any!, expectedResult: Boolean) Utility for testing equals() and hashCode() results at once. |
Public methods
assertAssignableFrom
static funassertAssignableFrom(
expected: Class<*>!,
actual: Class<*>!
): Unit
Deprecated: Deprecated in Java.
Asserts that class expected
is assignable from the class actual
. This verifies expected
is a parent class or a interface that actual
implements.
assertAssignableFrom
static funassertAssignableFrom(
expected: Class<*>!,
actual: Any!
): Unit
Deprecated: Deprecated in Java.
Asserts that the class expected
is assignable from the object actual
. This verifies expected
is a parent class or a interface that actual
implements.
assertContainsRegex
static funassertContainsRegex(
expectedRegex: String!,
actual: String!
): MatchResult!
Deprecated: Deprecated in Java.
Variant of assertContainsRegex(java.lang.String,java.lang.String,java.lang.String)
using a generic message.
assertContainsRegex
static funassertContainsRegex(
message: String!,
expectedRegex: String!,
actual: String!
): MatchResult!
Deprecated: Deprecated in Java.
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 Pattern.quote
.
assertContentsInAnyOrder
static funassertContentsInAnyOrder(
actual: MutableIterable<*>!,
vararg expected: Any!
): Unit
Deprecated: Deprecated in Java.
Variant of assertContentsInAnyOrder(String, Iterable, Object...) using a generic message.
assertContentsInAnyOrder
static funassertContentsInAnyOrder(
message: String!,
actual: MutableIterable<*>!,
vararg expected: Any!
): Unit
Deprecated: Deprecated in Java.
Asserts that actual
contains precisely the elements expected
, but in any order.
assertContentsInOrder
static funassertContentsInOrder(
actual: MutableIterable<*>!,
vararg expected: Any!
): Unit
Deprecated: Deprecated in Java.
Variant of assertContentsInOrder(String, Iterable, Object...) using a generic message.
assertContentsInOrder
static funassertContentsInOrder(
message: String!,
actual: MutableIterable<*>!,
vararg expected: Any!
): Unit
Deprecated: Deprecated in Java.
Asserts that actual
contains precisely the elements expected
, and in the same order.
assertEmpty
static funassertEmpty(iterable: MutableIterable<*>!): Unit
Deprecated: Deprecated in Java.
Variant of assertEmpty(java.lang.String,java.lang.Iterable)
using a generic message.
assertEmpty
static funassertEmpty(
message: String!,
iterable: MutableIterable<*>!
): Unit
Deprecated: Deprecated in Java.
Asserts that iterable
is empty.
assertEmpty
static funassertEmpty(
message: String!,
map: MutableMap<*, *>!
): Unit
Deprecated: Deprecated in Java.
Asserts that map
is empty.
assertEmpty
static funassertEmpty(map: MutableMap<*, *>!): Unit
Deprecated: Deprecated in Java.
Variant of assertEmpty(java.lang.String,java.util.Map)
using a generic message.
assertEquals
static funassertEquals(
expected: ByteArray!,
actual: ByteArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates specific element mismatch.
assertEquals
static funassertEquals(
expected: DoubleArray!,
actual: DoubleArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates first specific element mismatch.
assertEquals
static funassertEquals(
expected: IntArray!,
actual: IntArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates first specific element mismatch.
assertEquals
static funassertEquals(
expected: Array<Any!>!,
actual: Array<Any!>!
): Unit
Deprecated: Deprecated in Java.
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.
assertEquals
static funassertEquals(
message: String!,
expected: ByteArray!,
actual: ByteArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates specific element mismatch.
assertEquals
static funassertEquals(
message: String!,
expected: DoubleArray!,
actual: DoubleArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates first specific element mismatch.
assertEquals
static funassertEquals(
message: String!,
expected: IntArray!,
actual: IntArray!
): Unit
Deprecated: Deprecated in Java.
Asserts that array actual
is the same size and every element equals those in array expected
. On failure, message indicates first specific element mismatch.
assertEquals
static funassertEquals(
message: String!,
expected: Array<Any!>!,
actual: Array<Any!>!
): Unit
Deprecated: Deprecated in Java.
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.
assertEquals
static funassertEquals(
message: String!,
expected: MutableSet<*>!,
actual: MutableSet<*>!
): Unit
Deprecated: Deprecated in Java.
Asserts that two sets contain the same elements.
assertEquals
static funassertEquals(
expected: MutableSet<*>!,
actual: MutableSet<*>!
): Unit
Deprecated: Deprecated in Java.
Asserts that two sets contain the same elements.
assertMatchesRegex
static funassertMatchesRegex(
expectedRegex: String!,
actual: String!
): MatchResult!
Deprecated: Deprecated in Java.
Variant of assertMatchesRegex(java.lang.String,java.lang.String,java.lang.String)
using a generic message.
assertMatchesRegex
static funassertMatchesRegex(
message: String!,
expectedRegex: String!,
actual: String!
): MatchResult!
Deprecated: Deprecated in Java.
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 Pattern.quote
.
assertNotContainsRegex
static funassertNotContainsRegex(
expectedRegex: String!,
actual: String!
): Unit
Deprecated: Deprecated in Java.
Variant of assertNotContainsRegex(java.lang.String,java.lang.String,java.lang.String)
using a generic message.
assertNotContainsRegex
static funassertNotContainsRegex(
message: String!,
expectedRegex: String!,
actual: String!
): Unit
Deprecated: Deprecated in Java.
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 Pattern.quote
.
assertNotEmpty
static funassertNotEmpty(iterable: MutableIterable<*>!): Unit
Deprecated: Deprecated in Java.
Variant of assertNotEmpty(String, Iterable) using a generic message.
assertNotEmpty
static funassertNotEmpty(
message: String!,
iterable: MutableIterable<*>!
): Unit
Deprecated: Deprecated in Java.
Asserts that iterable
is not empty.
assertNotEmpty
static funassertNotEmpty(
message: String!,
map: MutableMap<*, *>!
): Unit
Deprecated: Deprecated in Java.
Asserts that map
is not empty.
assertNotEmpty
static funassertNotEmpty(map: MutableMap<*, *>!): Unit
Deprecated: Deprecated in Java.
Variant of assertNotEmpty(java.lang.String,java.util.Map)
using a generic message.
assertNotEqual
static funassertNotEqual(
unexpected: Any!,
actual: Any!
): Unit
Deprecated: Deprecated in Java.
Variant of assertNotEqual(java.lang.String,java.lang.Object,java.lang.Object)
using a generic message.
assertNotEqual
static funassertNotEqual(
message: String!,
unexpected: Any!,
actual: Any!
): Unit
Deprecated: Deprecated in Java.
Asserts that actual
is not equal unexpected
, according to both ==
and Object.equals
.
assertNotMatchesRegex
static funassertNotMatchesRegex(
expectedRegex: String!,
actual: String!
): Unit
Deprecated: Deprecated in Java.
Variant of assertNotMatchesRegex(java.lang.String,java.lang.String,java.lang.String)
using a generic message.
assertNotMatchesRegex
static funassertNotMatchesRegex(
message: String!,
expectedRegex: String!,
actual: String!
): Unit
Deprecated: Deprecated in Java.
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 Pattern.quote
.
checkEqualsAndHashCodeMethods
static funcheckEqualsAndHashCodeMethods(
lhs: Any!,
rhs: Any!,
expectedResult: Boolean
): Unit
Deprecated: Deprecated in Java.
Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean...)} using a generic message.
checkEqualsAndHashCodeMethods
static funcheckEqualsAndHashCodeMethods(
message: String!,
lhs: Any!,
rhs: Any!,
expectedResult: Boolean
): Unit
Deprecated: Deprecated in Java.
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.)
Parameters | |
---|---|
lhs |
Any!: An Object for which equals() and hashCode() are to be tested. |
rhs |
Any!: As lhs. |
expectedResult |
Boolean: True if the objects should compare equal, false if not. |