### Question:
OpenApiVersionGteValidator implements OpenApiValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, OpenAPI openAPI) { if (openAPI.getOpenapi() == null) { return singletonList(new OasViolation(location.property("openapi"), ViolationMessages.REQUIRED)); } String[] semver = openAPI.getOpenapi().split("\\."); String[] expectedSemver = versionGte.split("\\."); boolean ok = semver[0].equals(expectedSemver[0]) && semver[1].equals(expectedSemver[1]) && Integer.parseInt(semver[2]) >= Integer.valueOf(expectedSemver[2]); if (ok) { return emptyList(); } return singletonList(new OasViolation(location.property("openapi"), ERROR + versionGte)); } OpenApiVersionGteValidator(String versionGte); @Override List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, OpenAPI openAPI); static final String CONFIG_KEY; static final String ERROR; }### Answer:
@Test public void testValidate() { OpenAPI openAPI = loadRelative("petstore-openapi-wrong.yaml"); OasSpecValidator oasSpecValidator = oasSpecValidatorFactory.create( singleOption(OpenApiVersionGteValidator.CONFIG_KEY, "3.0.2") ); List<OasViolation> violations = oasSpecValidator.validate(createContext(openAPI), openAPI); assertThat(violations).hasSize(1); assertThat(violations) .containsExactly(createViolation(OpenApiVersionGteValidator.ERROR + "3.0.2", "openapi", null)); }