@Test public void testGetRecentlyModified() throws Exception { List<Site> recentlyModified = alfrescoDocumentsService.getRecentlyModified("userId", false); int number = 0; for (Site site : recentlyModified) { number += site.getRecentModifiedDocuments().size(); } assertEquals(3, number); // document1 + document2 + document3 }
@Test public void testGetRecentlyModifiedJson() throws Exception { String recentlyModifiedJson = alfrescoDocumentsService.getRecentlyModifiedJson("userId"); ObjectMapper mapper = new ObjectMapper(); List<Site> list = new ArrayList<Site>(); List<Site> recentlyModified = mapper.readValue(recentlyModifiedJson, new TypeReference<List<Site>>() {}); int number = 0; for (Site site : recentlyModified) { number += site.getRecentModifiedDocuments().size(); } assertEquals(3, number); // document1 + document2 + document3 }
@Test public void testGetAlfrescoCount() throws ExecutionException, InterruptedException { // Given Site site = new Site(); Document document = new Document(); site.setRecentModifiedDocuments(Arrays.asList(document)); when(alfrescoDocumentsService.getRecentlyModified(anyString(), anyBoolean())) .thenReturn(Arrays.asList(site)); // When Future<CountResult> count = notificationService.getAlfrescoCount("anyScreenName"); // Then assertEquals(1, (int) count.get().getCount()); }
@Test public void testGetAlfrescoDocuments() { // Given Site site = new Site(); Document document = new Document(); site.setRecentModifiedDocuments(Arrays.asList(document)); when(alfrescoDocumentsService.getRecentlyModified(anyString(), anyBoolean())) .thenReturn(Arrays.asList(site)); // When List<Site> sites = notificationService.getAlfrescoDocuments("anyScreenName"); // Then assertEquals(1, sites.get(0).getRecentModifiedDocuments().size()); }