### Question:
AgendaValidator extends DataObjectValidator<Agenda, DataObjectRequest<Agenda>> { void verifyUniqueOperationsName(List<Operation> operations) { Set<String> opNames = new HashSet<>(); for (Operation op : operations) { String opName = op.getName(); if (opName == null || opName.isEmpty()) throw new ValidationException("Operations must have names."); boolean unique = opNames.add(op.getName().toLowerCase()); if (!unique) throw new ValidationException("Operation names must be unique."); } }  @Override void validatePOST(DataObjectRequest<Agenda> request); AgendaValidator setJsonContext(JsonContext jsonContext);  }### Answer:
@Test(expectedExceptions = ValidationException.class, expectedExceptionsMessageRegExp = ".*Operation names must be unique.*") public void testDuplicateOperationNames() { validator.verifyUniqueOperationsName(Arrays.asList( createOperation("foo"), createOperation("FOo") )); }
@Test(expectedExceptions = ValidationException.class, expectedExceptionsMessageRegExp = ".*Operations must have names.*") public void testMissingOperationNames() { validator.verifyUniqueOperationsName(Collections.singletonList(createOperation(""))); }