Skip to content

Instantly share code, notes, and snippets.

@rafaeltoledo
Last active November 9, 2016 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeltoledo/37635b4466041022ba01 to your computer and use it in GitHub Desktop.
Save rafaeltoledo/37635b4466041022ba01 to your computer and use it in GitHub Desktop.
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 22)
public class MainActivityTest {
@Test
public void shouldHideButtonAfterClick() {
MainActivity activity = Robolectric.setupActivity(MainActivity.class);
Button button = (Button) activity.findViewById(R.id.hide);
button.performClick();
assertThat(button.getVisibility(), is(View.GONE));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment