Last active
August 29, 2015 14:06
-
-
Save chaudum/240bb5f38a3409d7a656 to your computer and use it in GitHub Desktop.
Mocking
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
OsService osService = mock(OsService.class); | |
OsStats osStats = mock(OsStats.class); | |
OsStats.Mem mem = mock(OsStats.Mem.class); | |
when(osStats.mem()).thenReturn(mem); | |
when(mem.actualFree()).thenReturn(byteSizeValue); | |
when(mem.actualUsed()).thenReturn(byteSizeValue); | |
when(mem.usedPercent()).thenReturn((short) 22); | |
when(mem.freePercent()).thenReturn((short) 78); | |
bind(OsService.class).toInstance(osService); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment