Skip to content

Instantly share code, notes, and snippets.

@Diolor
Created March 18, 2017 02:02
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 Diolor/534b4db01835e2912ac2752d91723606 to your computer and use it in GitHub Desktop.
Save Diolor/534b4db01835e2912ac2752d91723606 to your computer and use it in GitHub Desktop.
FilterButtonPresenterTest
@RunWith(MockitoJUnitRunner.class)
class FilterButtonPresenterTest {
@Mock
AccountInteractor accountInteractor;
@Mock
StateView<FilterButtonState> view;
@InjectMocks
FilterButtonPresenter testee;
@Test
void userIsLoggedIn(){
given(accountInteractor.isUserLoggedIn())
.willReturn(just(true));
// When
testee.onStart(view);
// Then
verify(view)
.updateState(new FilterButtonState(true));
}
@Test
void userIsLoggedOut(){
given(accountInteractor.isUserLoggedIn())
.willReturn(just(false));
// When
testee.onStart(view);
// Then
verify(view)
.updateState(new FilterButtonState(false));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment