OrganizationServiceImpl extends AbstractConsoleService<OrganizationTblDao> implements OrganizationService { List<OrganizationTbl> getOrgTblCreateList(List<OrganizationTbl> remoteDBOrgs, List<OrganizationTbl> localDBOrgs) { Set<Long> storedOrgId = new HashSet<>(); localDBOrgs.forEach(org->storedOrgId.add(org.getOrgId())); return remoteDBOrgs.stream().filter(org->!storedOrgId.contains(org.getOrgId())).collect(Collectors.toList()); }  @Override void updateOrganizations(); @Override List<OrganizationTbl> getAllOrganizations(); @Override OrganizationTbl getOrganizationTblByCMSOrganiztionId(long organizationId); @Override OrganizationTbl getOrgByName(String name); @Override List<OrganizationTbl> getInvolvedOrgs(); @Override OrganizationTbl getOrganization(long xpipeOrgId);  }
@Test public void testGetOrgTblCreateListCase1() { List<OrganizationTbl> remoteDBOrgs = createOrganizationTblList(10); List<OrganizationTbl> localDBOrgs = createOrganizationTblList(5); List<OrganizationTbl> result = organizationService.getOrgTblCreateList(remoteDBOrgs, localDBOrgs); result.forEach(org->logger.info("org id: {}", org.getOrgId())); Assert.assertEquals(5, result.size()); }
@Test public void testGetOrgTblCreateListCase2() { List<OrganizationTbl> remoteDBOrgs = createOrganizationTblList(10); List<OrganizationTbl> localDBOrgs = createOrganizationTblList(11); List<OrganizationTbl> result = organizationService.getOrgTblCreateList(remoteDBOrgs, localDBOrgs); result.forEach(org->logger.info("org id: {}", org.getOrgId())); Assert.assertEquals(0, result.size()); }