Created
February 19, 2017 08:17
-
-
Save nontravis/2a506bffced2c5fa4e4e29e1bc6ae3c3 to your computer and use it in GitHub Desktop.
Example_MainPresenterUnitTest
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
@RunWith(JUnit4.class) | |
class MainPresenterUnitTest{ | |
@Before | |
public void setup(){ | |
... | |
} | |
@Test | |
public void calculate(){ | |
assertThat( presenter.calculate(10), is(equalTo(20))); | |
... | |
} | |
@Test | |
public void clickGotoSecondActivity(){ | |
presenter.clickGotoSecondActivity(); | |
verify(RxBus.get(),times(1)).post(any(GoToSecondEvent.class)); | |
... | |
} | |
@Test | |
public void requestService(){ | |
presenter.requestService(); | |
// test some logic | |
... | |
} | |
@Test | |
public void onReceiveSuccessEvent(SuccessEvent event){ | |
presenter.onReceiveSuccessEvent(new SuccessEvent()); | |
// test some logic | |
... | |
} | |
@Test | |
public void onReceiveFailEvent(FailEvent event){ | |
presenter.onReceiveFailEvent(new FailEvent()); | |
// test some logic | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment