Last active
September 5, 2016 17:28
-
-
Save miquelbeltran/de0156c2f87c850af4ef4052b9709dac to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@RunWith(RobolectricGradleTestRunner.class) | |
@Config(constants = BuildConfig.class) | |
public class ProfileFrameLayoutTest { | |
private ProfileFrameLayout profileView; | |
@Mock | |
ProfilePresenter presenter; | |
@Before | |
public void setUp() throws Exception { | |
MockitoAnnotations.initMocks(this); | |
profileView = new ProfileFrameLayout(RuntimeEnvironment.application); | |
profileView.setPresenter(presenter); | |
} | |
@Test | |
public void testEmpty() throws Exception { | |
verify(presenter).attachView(profileView); | |
asserThat(profileView.textUsername.getText().toString()).isEmpty(); | |
} | |
@Test | |
public void testLeaveView() throws Exception { | |
profileView.onDetachedFromWindow(); | |
verify(presenter).detachView(); | |
} | |
@Test | |
public void testReturnToView() throws Exception { | |
reset(presenter); | |
profileView.onAttachedToWindow(); | |
verify(presenter).attachView(profileView); | |
} | |
@Test | |
public void testDisplay() throws Exception { | |
UserProfile user = new UserProfile(USER); | |
profileView.display(user); | |
asserThat(profileView.textUsername.getText().toString()).isEqualTo(USER); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment