ConsentOneToOneAssertion implements ConsentAssertion { @Override public void assertConsentDto(ConsentDto consentDto) throws IllegalArgumentException { int countProvidersDisclosureIsMadeTo = 0; int countProvidersPermittedToDisclose = 0; try { countProvidersDisclosureIsMadeTo += consentDto .getOrganizationalProvidersDisclosureIsMadeTo().size(); } catch (NullPointerException e) { } try { countProvidersDisclosureIsMadeTo += consentDto .getProvidersDisclosureIsMadeTo().size(); } catch (NullPointerException e) { } try { countProvidersPermittedToDisclose += consentDto .getOrganizationalProvidersPermittedToDisclose().size(); } catch (NullPointerException e) { } try { countProvidersPermittedToDisclose += consentDto .getProvidersPermittedToDisclose().size(); } catch (NullPointerException e) { } Assert.isTrue( countProvidersDisclosureIsMadeTo == 1, "'countProvidersDisclosureIsMadeTo' must be 1 in order to be a one-to-one policy."); Assert.isTrue( countProvidersPermittedToDisclose == 1, "'countProvidersPermittedToDisclose' must be 1 in order to be a one-to-one policy."); }  @Override void assertConsentDto(ConsentDto consentDto);  }
@Test public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind_From_Org() { thrown.expect(IllegalArgumentException.class); Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Fail_With_To_Org_From_Ind_From_Org() { thrown.expect(IllegalArgumentException.class); Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Fail_With_To_Ind_From_Ind_From_Org() { thrown.expect(IllegalArgumentException.class); Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Org() { thrown.expect(IllegalArgumentException.class); Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind() { thrown.expect(IllegalArgumentException.class); Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Success_With_To_Ind_From_Org() { Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Success_With_To_Org_From_Org() { Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets .newSet("mockOrganizationalProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Success_With_To_Org_From_Ind() { Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets .newSet("mockOrganizationalProvidersDisclosureIsMadeTo"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }
@Test public void testAssertConsentDto_Success_With_To_Ind_From_Ind() { Set<String> mockProvidersDisclosureIsMadeTo = Sets .newSet("mockProvidersDisclosureIsMadeTo"); Set<String> mockProvidersPermittedToDisclose = Sets .newSet("mockProvidersPermittedToDisclose"); ConsentDto mockConsentDto = new ConsentDto(); mockConsentDto .setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo); mockConsentDto .setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose); sut.assertConsentDto(mockConsentDto); }