Created
January 26, 2016 14:38
-
-
Save TechIsFun/e64619408a88ea745e23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testOnClickMapButton() throws Exception { | |
Context spyContext = spy(RuntimenEnvironment.application); | |
mActivity.onClickOnMapButton(spyContext); | |
verify(spyContext).startActivity(argThat(googleMapsIntentMatcher())); | |
} | |
private static Matcher<Intent> googleMapsIntentMatcher() { | |
return new ArgumentMatcher<Intent>() { | |
@Override | |
public boolean matches(Object argument) { | |
if (argument instanceof Intent) { | |
Intent intent = (Intent) argument; | |
return "com.google.android.apps.maps".equals(intent.getPackage()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment