@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); }
@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."); }
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."); } }
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."); }  }
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); }
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);  }