Book Image

Learning Android Application Testing

Book Image

Learning Android Application Testing

Overview of this book

Table of Contents (16 chapters)
Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 specified String. It fails with the specified message if it does not.

  • assertContainsInAnyOrder: This asserts that the specified Iterable contains precisely the elements expected, but in any order.

  • assertContainsInOrder: This asserts that the specified Iterable contains precisely the elements expected, but in the same order.

  • assertEmpty: This asserts that an Iterable is empty.

  • assertEquals: This is for some Collections...