@Test
  public void shouldGetOrganizationByEntityID() {
    CSD csd = InitialData.getInitialData();
    csd.getProviderDirectory().getProviders().clear();
    csd.getServiceDirectory().getServices().clear();
    csd.getFacilityDirectory().getFacilities().clear();
    Organization organization = InitialData.createOrganization(new DateTime(), "EntityIDToFind");
    csd.getOrganizationDirectory().getOrganizations().add(organization);
    csdService.update(csd);
    assertTrue(csdService.getCSD().equals(csd));

    assertEquals(organizationService.getOrganizationByEntityID("EntityIDToFind"), organization);
  }
  @Test
  public void shouldGetEntitiesUpdatedAfterGivenDate() {
    DateTime dateUpdated = new DateTime(2020, 1, 1, 1, 1);

    Organization organization =
        InitialData.createOrganization(dateUpdated.plusSeconds(1), "lastUpdated");

    CSD csd = InitialData.getInitialData();
    csd.getProviderDirectory().getProviders().clear();
    csd.getServiceDirectory().getServices().clear();
    csd.getFacilityDirectory().getFacilities().clear();
    csd.getOrganizationDirectory().getOrganizations().add(organization);
    csdService.update(csd);
    assertTrue(csdService.getCSD().equals(csd));

    Set<Organization> lastUpdated = organizationService.getModifiedAfter(dateUpdated);

    assertEquals(1, lastUpdated.size());

    assertEquals(lastUpdated.iterator().next(), organization);
  }
  @Test
  public void shouldUpdateOrganizationDirectoryEntity() {
    CSD csd = InitialData.getInitialData();
    csd.getProviderDirectory().getProviders().clear();
    csd.getServiceDirectory().getServices().clear();
    csd.getFacilityDirectory().getFacilities().clear();
    csdService.update(csd);
    assertTrue(csdService.getCSD().equals(csd));

    csd = InitialData.getInitialData();
    csd.getOrganizationDirectory()
        .getOrganizations()
        .iterator()
        .next()
        .setPrimaryName("updated name");
    csd.getOrganizationDirectory()
        .getOrganizations()
        .add(InitialData.createOrganization(new DateTime(), "newOrganization"));
    organizationService.update(csd.getOrganizationDirectory().getOrganizations());
    Set<Organization> organizations = new HashSet<>(organizationService.allOrganizations());
    assertTrue(organizations.equals(csd.getOrganizationDirectory().getOrganizations()));
  }