@Test public void givenArchiveUnitProfileAndValidUnitThenValidationOK() throws Exception { CachedArchiveUnitProfileLoader archiveUnitProfileLoader = mock(CachedArchiveUnitProfileLoader.class); doReturn(Optional.of( new ArchiveUnitProfileModel() .setControlSchema("{\n" + " \"$schema\": \"http: " \"id\": \"http: " \"type\": \"object\",\n" + " \"properties\": {\n" + " \"_id\": {\n" + " \"type\": \"string\"\n" + " }\n" + " }\n" + "}\n") .setStatus(ArchiveUnitProfileStatus.ACTIVE) )).when(archiveUnitProfileLoader).loadArchiveUnitProfile("MyArchiveUnitProfile"); CachedSchemaValidatorLoader schemaValidatorLoader = new CachedSchemaValidatorLoader(10, 6); UnitValidator unitValidator = new UnitValidator(archiveUnitProfileLoader, schemaValidatorLoader); ObjectNode unitJson = (ObjectNode) JsonHandler.getFromInputStream( PropertiesUtils.getResourceAsStream(COMPLEX_JSON_FILE)).get(TAG_ARCHIVE_UNIT); unitJson.put(SedaConstants.TAG_ARCHIVE_UNIT_PROFILE, "MyArchiveUnitProfile"); unitValidator.validateUnit(unitJson); }
public void validateUnit(ObjectNode unitJson) throws MetadataValidationException { validateStartAndEndDates(unitJson); validateInternalSchema(unitJson); validateArchiveUnitProfile(unitJson); }
UnitValidator { public void validateUnit(ObjectNode unitJson) throws MetadataValidationException { validateStartAndEndDates(unitJson); validateInternalSchema(unitJson); validateArchiveUnitProfile(unitJson); } }
UnitValidator { public void validateUnit(ObjectNode unitJson) throws MetadataValidationException { validateStartAndEndDates(unitJson); validateInternalSchema(unitJson); validateArchiveUnitProfile(unitJson); } UnitValidator(CachedArchiveUnitProfileLoader archiveUnitProfileLoader,
        CachedSchemaValidatorLoader schemaValidatorLoader); }
UnitValidator { public void validateUnit(ObjectNode unitJson) throws MetadataValidationException { validateStartAndEndDates(unitJson); validateInternalSchema(unitJson); validateArchiveUnitProfile(unitJson); } UnitValidator(CachedArchiveUnitProfileLoader archiveUnitProfileLoader,
        CachedSchemaValidatorLoader schemaValidatorLoader); void validateUnit(ObjectNode unitJson); void validateInternalSchema(ObjectNode archiveUnit); void validateArchiveUnitProfile(ObjectNode archiveUnit); void validateStartAndEndDates(JsonNode archiveUnit); }
UnitValidator { public void validateUnit(ObjectNode unitJson) throws MetadataValidationException { validateStartAndEndDates(unitJson); validateInternalSchema(unitJson); validateArchiveUnitProfile(unitJson); } UnitValidator(CachedArchiveUnitProfileLoader archiveUnitProfileLoader,
        CachedSchemaValidatorLoader schemaValidatorLoader); void validateUnit(ObjectNode unitJson); void validateInternalSchema(ObjectNode archiveUnit); void validateArchiveUnitProfile(ObjectNode archiveUnit); void validateStartAndEndDates(JsonNode archiveUnit);  }