@Test public void testAssertUniqueIds_All_Matches_Throws_ConflictingRequestException() { thrown.expect(ConflictingRequestException.class); final PolicyDto p1 = new PolicyDto(); final PolicyDto p2 = new PolicyDto(); final PolicyDto p3 = new PolicyDto(); final String policyId1 = "policyId1"; final String policyId2 = policyId1; final String policyId3 = policyId2; p1.setId(policyId1); p2.setId(policyId2); p3.setId(policyId3); final List<PolicyDto> policyDtos = Arrays.asList(p1, p2, p3); AssertionUtils.assertUniqueIds(policyDtos); }
public static void assertUniqueIds(List<PolicyDto> policyDtos) { final long countDistinctIds = policyDtos.stream().map(PolicyDto::getId) .distinct().count(); if (countDistinctIds != policyDtos.size()) { throw new ConflictingRequestException( "Policy IDs are not unique in the request."); } }
AssertionUtils { public static void assertUniqueIds(List<PolicyDto> policyDtos) { final long countDistinctIds = policyDtos.stream().map(PolicyDto::getId) .distinct().count(); if (countDistinctIds != policyDtos.size()) { throw new ConflictingRequestException( "Policy IDs are not unique in the request."); } } }
AssertionUtils { public static void assertUniqueIds(List<PolicyDto> policyDtos) { final long countDistinctIds = policyDtos.stream().map(PolicyDto::getId) .distinct().count(); if (countDistinctIds != policyDtos.size()) { throw new ConflictingRequestException( "Policy IDs are not unique in the request."); } }  }
AssertionUtils { public static void assertUniqueIds(List<PolicyDto> policyDtos) { final long countDistinctIds = policyDtos.stream().map(PolicyDto::getId) .distinct().count(); if (countDistinctIds != policyDtos.size()) { throw new ConflictingRequestException( "Policy IDs are not unique in the request."); } }  static void assertNotExistsInPolicyRepository(
			List<PolicyDto> policyDtos,
			Function<String, Policy> policyFindFunction); static void assertNotExistsInPolicyRepository(String policyId,
			Function<String, Policy> policyFindFunction); static void assertPoliciesNotEmpty(final List<Policy> policies,
			final String policyId, final String wildcard); static void assertPolicyId(String policyId); static void assertPolicyIdConsistency(String requestPolicyId,
			final String policyContentPolicyId); static void assertPolicyNotNull(final Policy policy,
			final String policyId); static void assertUniqueIds(List<PolicyDto> policyDtos); }
AssertionUtils { public static void assertUniqueIds(List<PolicyDto> policyDtos) { final long countDistinctIds = policyDtos.stream().map(PolicyDto::getId) .distinct().count(); if (countDistinctIds != policyDtos.size()) { throw new ConflictingRequestException( "Policy IDs are not unique in the request."); } }  static void assertNotExistsInPolicyRepository(
			List<PolicyDto> policyDtos,
			Function<String, Policy> policyFindFunction); static void assertNotExistsInPolicyRepository(String policyId,
			Function<String, Policy> policyFindFunction); static void assertPoliciesNotEmpty(final List<Policy> policies,
			final String policyId, final String wildcard); static void assertPolicyId(String policyId); static void assertPolicyIdConsistency(String requestPolicyId,
			final String policyContentPolicyId); static void assertPolicyNotNull(final Policy policy,
			final String policyId); static void assertUniqueIds(List<PolicyDto> policyDtos);  }