### Question:
TagMustBeReferencedValidator implements TagValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Tag tag) { Set<String> allOperationsTags = getAllOperationsTags(context); List<OasViolation> violations = new ArrayList<>(); if (!allOperationsTags.contains(tag.getName())) { violations.add(new OasViolation(location, ERROR)); } return violations; }  @Override List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Tag tag); static final String CONFIG_KEY; static final String ERROR; }### Answer:
@Test public void testValidate() { OpenAPI openAPI = loadRelative("petstore-tag-redundant.yaml"); OasSpecValidator oasSpecValidator = oasSpecValidatorFactory.create( singleOption(TagMustBeReferencedValidator.CONFIG_KEY, "true") ); List<OasViolation> violations = oasSpecValidator.validate(createContext(openAPI), openAPI); assertThat(violations).hasSize(1); assertThat(violations) .containsExactly(createViolation(TagMustBeReferencedValidator.ERROR, "tags[1]", TAG)); }