Created
April 24, 2015 10:50
-
-
Save kmdupr33/528c6094c43a74f8c0be 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
| public void testCacheUpdate() { | |
| //Arrange | |
| CalculationCache calcCache = mock(CalculationCache.class); | |
| when(calcCache.contains()).thenReturn(false); | |
| Calculator calculator = mock(Calculator.class); | |
| MathNerd mathNerd = new MathNerd(calcCache, calculator); | |
| Calculation calculation = new Calculation("e^2000"); | |
| //Act | |
| mathNerd.doIntenseCalculationInBackground(calculation, null); | |
| //Assert should use calculator to perform calcluation because cache was empty | |
| verify(calculator).doIntenseCalculationInBackground(any()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment