Last active
August 22, 2019 10:41
-
-
Save IvanShafran/25f7c7d4d36e613182faa94d8c663c58 to your computer and use it in GitHub Desktop.
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
public class ShowRateUsLogicTest { | |
// property declaration is skipped | |
@Before public void setUp() { | |
final Context mockedContext = new SPMockBuilder().createContext(); | |
rateUsPreferences = new RateUsPreferencesImpl(mockedContext); | |
buyPreferences = new BuyPreferencesImpl(mockedContext); | |
time = Mockito.mock(Time.class); | |
showRateUsLogic = new ShowRateUsLogic(rateUsPreferences, buyPreferences, time); | |
} | |
// first test code leaves the same | |
// second test code changed only in time mocking | |
@Test public void onThreeClicksAndItShouldShow() { | |
// ... | |
// set current time to be 90 days after first show | |
Mockito.when(time.getCurrentTimeMillis()).thenReturn(calendar.getTimeInMillis() + TimeUnit.DAYS.toMillis(90)); | |
Assert.assertTrue(showRateUsLogic.shouldShowRateUs()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment