IntentMatchers
@CheckReturnValue
class IntentMatchers
A collection of hamcrest matchers for matching Intent
objects.
Summary
Public functions |
|
---|---|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!> |
doesNotHaveExtraWithKey(keyMatcher: Matcher<String!>) |
java-static Matcher<Intent!> |
|
java-static Matcher<Intent!>! |
filterEquals(expectedIntent: Intent!) Matches an intent if it |
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
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!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
hasDataString(stringMatcher: Matcher<String!>!) |
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
hasExtraWithKey(keyMatcher: Matcher<String!>!) |
java-static Matcher<Intent!>! |
hasExtraWithKey(key: String!) |
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
hasPackage(packageMatcher: Matcher<String!>!) |
java-static Matcher<Intent!>! |
hasPackage(packageName: String!) |
java-static Matcher<Intent!>! |
|
java-static Matcher<Intent!>! |
|
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!>! |
Matches an intent based on the package of activity which can handle the intent. |
Public functions
doesNotHaveExtraWithKey
java-static fun doesNotHaveExtraWithKey(keyMatcher: Matcher<String!>): Matcher<Intent!>
filterEquals
java-static fun filterEquals(expectedIntent: Intent!): Matcher<Intent!>!
Matches an intent if it filterEquals
the expected intent.
hasCategories
java-static fun hasCategories(categoriesMatcher: Matcher<(Mutable)Iterable<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 |
hasExtra
java-static fun hasExtra(keyMatcher: Matcher<String!>!, valueMatcher: Matcher<Any!>!): 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.