Even more assertions
If the assertions that are reviewed previously do not seem to be enough for your tests' needs, there is still another class included in the Android framework that covers other cases. This class is MoreAsserts
(http://developer.android.com/reference/android/test/MoreAsserts.html).
These methods are also overloaded to support different parameter types. Among the assertions, we can find the following:
assertAssignableFrom
: This asserts that an object is assignable to a class.assertContainsRegex
: This asserts that an expected Regex matches any substring of the specifiedString
. It fails with the specified message if it does not.assertContainsInAnyOrder
: This asserts that the specifiedIterable
contains precisely the elements expected, but in any order.assertContainsInOrder
: This asserts that the specifiedIterable
contains precisely the elements expected, but in the same order.assertEmpty
: This asserts that anIterable
is empty.assertEquals
: This is for someCollections...