@Test void testValidateCrnFilterWrongResourceType() { Assertions.assertThrows(BadRequestException.class, () -> { underTest.validateCrnFilter(Set.of(ENV_CRN), Crn.ResourceType.USER); }); }
@VisibleForTesting void validateCrnFilter(Set<String> crnFilter, Crn.ResourceType resourceType) { crnFilter.forEach(crnString -> { try { Crn crn = Crn.safeFromString(crnString); if (crn.getResourceType() != resourceType) { throw new BadRequestException(String.format("Crn %s is not of expected type %s", crnString, resourceType)); } } catch (CrnParseException e) { throw new BadRequestException(e.getMessage(), e); } }); }
UserSyncRequestValidator { @VisibleForTesting void validateCrnFilter(Set<String> crnFilter, Crn.ResourceType resourceType) { crnFilter.forEach(crnString -> { try { Crn crn = Crn.safeFromString(crnString); if (crn.getResourceType() != resourceType) { throw new BadRequestException(String.format("Crn %s is not of expected type %s", crnString, resourceType)); } } catch (CrnParseException e) { throw new BadRequestException(e.getMessage(), e); } }); } }
UserSyncRequestValidator { @VisibleForTesting void validateCrnFilter(Set<String> crnFilter, Crn.ResourceType resourceType) { crnFilter.forEach(crnString -> { try { Crn crn = Crn.safeFromString(crnString); if (crn.getResourceType() != resourceType) { throw new BadRequestException(String.format("Crn %s is not of expected type %s", crnString, resourceType)); } } catch (CrnParseException e) { throw new BadRequestException(e.getMessage(), e); } }); }  }
UserSyncRequestValidator { @VisibleForTesting void validateCrnFilter(Set<String> crnFilter, Crn.ResourceType resourceType) { crnFilter.forEach(crnString -> { try { Crn crn = Crn.safeFromString(crnString); if (crn.getResourceType() != resourceType) { throw new BadRequestException(String.format("Crn %s is not of expected type %s", crnString, resourceType)); } } catch (CrnParseException e) { throw new BadRequestException(e.getMessage(), e); } }); }  void validateParameters(String accountId, String actorCrn, Set<String> environmentCrnFilter, UserSyncRequestFilter userSyncRequestFilter); }
UserSyncRequestValidator { @VisibleForTesting void validateCrnFilter(Set<String> crnFilter, Crn.ResourceType resourceType) { crnFilter.forEach(crnString -> { try { Crn crn = Crn.safeFromString(crnString); if (crn.getResourceType() != resourceType) { throw new BadRequestException(String.format("Crn %s is not of expected type %s", crnString, resourceType)); } } catch (CrnParseException e) { throw new BadRequestException(e.getMessage(), e); } }); }  void validateParameters(String accountId, String actorCrn, Set<String> environmentCrnFilter, UserSyncRequestFilter userSyncRequestFilter);  }