@Test public void testGetCount() throws Exception { User user = mock(User.class); when(user.getScreenName()).thenReturn("anyScreenName"); for (String s : NotificationServiceName.allNamesAsList()) { notificationService.getCount(s, user); } // No exception is good, meaning that no exception related to reflection occured. }