Last active
February 19, 2017 10:57
-
-
Save nontravis/c39f38b897c197304e8ce2c91e7642cc to your computer and use it in GitHub Desktop.
Example_MainActivityUnitTest
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(AndroidJUnit4.class) | |
@LargeTest | |
class MainActivityUnitTest{ | |
@Before | |
public void setup(){ | |
... | |
} | |
@Test | |
public void calculateSomeValue_case_1(int value){ | |
activity.calculateSomeValue(10); | |
assertThat( activity.getFinalResult(), is(equalTo(20))); | |
... | |
} | |
@Test | |
public void calculateSomeValue_case_2(int value){ | |
activity.calculateSomeValue(0); | |
assertThat( activity.getFinalResult(), is(equalTo(5))); | |
... | |
} | |
@Test | |
public void calculateSomeValue_case_3(int value){ | |
activity.calculateSomeValue(-10); | |
assertThat( activity.getFinalResult(), is(equalTo(10))); | |
... | |
} | |
@Test | |
public void clickGotoSecondActivity(){ | |
activity.clickGotoSecondActivity(); | |
// test view logic | |
... | |
} | |
@Test | |
public void showLoading(){ | |
activity.showLoading(); | |
// test view logic | |
... | |
} | |
@Test | |
public void hideLoading(){ | |
activity.showLoading(); | |
// test view logic | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment