@Test public void testGetSocialRequests() { // Given SocialRequest socialRequest = mock(SocialRequest.class); when(socialRelationService.getUserRequests(any(User.class), anyBoolean())) .thenReturn(Arrays.asList(socialRequest)); // When User user = mock(User.class); List<SocialRequest> requests = notificationService.getSocialRequests(user); // Then assertEquals(1, requests.size()); }