@CheckReturnValue
class IntentMatchers


A collection of hamcrest matchers for matching Intent objects.

Summary

Public functions

java-static Matcher<Intent!>!
java-static Matcher<Intent!>
java-static Matcher<Intent!>
java-static Matcher<Intent!>!
filterEquals(expectedIntent: Intent!)

Matches an intent if it filterEquals the expected intent.

java-static Matcher<Intent!>!
hasAction(actionMatcher: Matcher<String!>!)
java-static Matcher<Intent!>!
hasAction(action: String!)
java-static Matcher<Intent!>!
hasCategories(categoriesMatcher: Matcher<(Mutable)Iterable<String!>!>!)
java-static Matcher<Intent!>!
hasCategories(categories: (Mutable)Set<String!>!)
java-static Matcher<Intent!>!
hasComponent(className: String!)

Returns a matcher that will only match intents targeted to a single class by using hasClassName.

java-static Matcher<Intent!>!
hasComponent(componentMatcher: Matcher<ComponentName!>!)

Can match an intent by class name, package name or short class name.

java-static Matcher<Intent!>!
hasComponent(componentName: ComponentName!)

Returns a matcher that will only match intents targeted to the componentName's class, {@see * ComponentName#getClassName}.

java-static Matcher<Intent!>!
hasData(uriMatcher: Matcher<Uri!>!)
java-static Matcher<Intent!>!
hasData(uri: String!)
java-static Matcher<Intent!>!
hasData(uri: Uri!)
java-static Matcher<Intent!>!
hasDataString(stringMatcher: Matcher<String!>!)
java-static Matcher<Intent!>!
hasExtra(keyMatcher: Matcher<String!>!, valueMatcher: Matcher<Any!>!)
java-static Matcher<Intent!>!
<T> hasExtra(key: String!, value: T!)
java-static Matcher<Intent!>!
hasExtra(key: String!, valueMatcher: Matcher<Any!>!)
java-static Matcher<Intent!>!
hasExtraWithKey(keyMatcher: Matcher<String!>!)
java-static Matcher<Intent!>!
java-static Matcher<Intent!>!
hasExtras(bundleMatcher: Matcher<Bundle!>!)
java-static Matcher<Intent!>!
hasFlag(flag: Int)
java-static Matcher<Intent!>!
hasFlags(flags: IntArray!)
java-static Matcher<Intent!>!
hasFlags(flags: Int)
java-static Matcher<Intent!>!
hasPackage(packageMatcher: Matcher<String!>!)
java-static Matcher<Intent!>!
hasPackage(packageName: String!)
java-static Matcher<Intent!>!
hasType(typeMatcher: Matcher<String!>!)
java-static Matcher<Intent!>!
hasType(type: String!)
java-static Matcher<Intent!>!

Matches an intent if its package is the same as the target package for the instrumentation test.

java-static Matcher<Intent!>!
toPackage(packageName: String!)

Matches an intent based on the package of activity which can handle the intent.

Public functions

anyIntent

java-static fun anyIntent(): Matcher<Intent!>!

doesNotHaveExtraWithKey

java-static fun doesNotHaveExtraWithKey(keyMatcher: Matcher<String!>): Matcher<Intent!>

doesNotHaveExtraWithKey

java-static fun doesNotHaveExtraWithKey(key: String): Matcher<Intent!>

filterEquals

java-static fun filterEquals(expectedIntent: Intent!): Matcher<Intent!>!

Matches an intent if it filterEquals the expected intent.

hasAction

java-static fun hasAction(actionMatcher: Matcher<String!>!): Matcher<Intent!>!

hasAction

java-static fun hasAction(action: String!): Matcher<Intent!>!

hasCategories

java-static fun hasCategories(categoriesMatcher: Matcher<(Mutable)Iterable<String!>!>!): Matcher<Intent!>!

hasCategories

java-static fun hasCategories(categories: (Mutable)Set<String!>!): Matcher<Intent!>!

hasComponent

java-static fun hasComponent(className: String!): Matcher<Intent!>!

Returns a matcher that will only match intents targeted to a single class by using hasClassName. The input string must contain the package name + short class name. For example hasComponent("com.google.provider.NotePad").

Parameters
className: String!

complete class path

hasComponent

java-static fun hasComponent(componentMatcher: Matcher<ComponentName!>!): Matcher<Intent!>!

Can match an intent by class name, package name or short class name.

Parameters
componentMatcher: Matcher<ComponentName!>!

can be the value of hasClassName, hasPackageName or hasShortClassName

hasComponent

java-static fun hasComponent(componentName: ComponentName!): Matcher<Intent!>!

Returns a matcher that will only match intents targeted to the componentName's class, {@see * ComponentName#getClassName}. For example: Intent intent = new Intent() .setComponentName(new ComponentName("com.google.provider", "com.google.provider.Notepad")); will match all intents targeted to Notepad.java.

Parameters
componentName: ComponentName!

a componentName that has the target class specified

hasData

java-static fun hasData(uriMatcher: Matcher<Uri!>!): Matcher<Intent!>!

hasData

java-static fun hasData(uri: String!): Matcher<Intent!>!

hasData

java-static fun hasData(uri: Uri!): Matcher<Intent!>!

hasDataString

java-static fun hasDataString(stringMatcher: Matcher<String!>!): Matcher<Intent!>!

hasExtra

java-static fun hasExtra(keyMatcher: Matcher<String!>!, valueMatcher: Matcher<Any!>!): Matcher<Intent!>!

hasExtra

java-static fun <T> hasExtra(key: String!, value: T!): Matcher<Intent!>!

hasExtra

java-static fun hasExtra(key: String!, valueMatcher: Matcher<Any!>!): Matcher<Intent!>!

hasExtraWithKey

java-static fun hasExtraWithKey(keyMatcher: Matcher<String!>!): Matcher<Intent!>!

hasExtraWithKey

java-static fun hasExtraWithKey(key: String!): Matcher<Intent!>!

hasExtras

java-static fun hasExtras(bundleMatcher: Matcher<Bundle!>!): Matcher<Intent!>!

hasFlag

java-static fun hasFlag(flag: Int): Matcher<Intent!>!

hasFlags

java-static fun hasFlags(flags: IntArray!): Matcher<Intent!>!

hasFlags

java-static fun hasFlags(flags: Int): Matcher<Intent!>!

hasPackage

java-static fun hasPackage(packageMatcher: Matcher<String!>!): Matcher<Intent!>!

hasPackage

java-static fun hasPackage(packageName: String!): Matcher<Intent!>!

hasType

java-static fun hasType(typeMatcher: Matcher<String!>!): Matcher<Intent!>!

hasType

java-static fun hasType(type: String!): Matcher<Intent!>!

isInternal

java-static fun isInternal(): Matcher<Intent!>!

Matches an intent if its package is the same as the target package for the instrumentation test.

toPackage

java-static fun toPackage(packageName: String!): Matcher<Intent!>!

Matches an intent based on the package of activity which can handle the intent.

Parameters
packageName: String!

packages of activity that can handle the intent