@Test public void testGetEmailCount() throws Exception { // Given when(notesEmailCounterService.getCount(anyString())).thenReturn(1); User user = mock(User.class); when(user.getScreenName()).thenReturn("anyScreenName"); // When Future<CountResult> count = notificationService.getEmailCount(user); // Then assertEquals(1, (int) count.get().getCount()); }