### Question:
ConstraintViolationException extends ValidationException { public Set<ConstraintViolation<?>> getConstraintViolations() { return constraintViolations; } ConstraintViolationException(String message,
										Set<? extends ConstraintViolation<?>> constraintViolations);  ConstraintViolationException(Set<? extends ConstraintViolation<?>> constraintViolations); Set<ConstraintViolation<?>> getConstraintViolations();  }### Answer:
@Test public void testCreationOfConstraintViolationException() { Set<ConstraintViolation<ConstraintViolationExceptionTest>> constraintViolations = new HashSet<ConstraintViolation<ConstraintViolationExceptionTest>>(); constraintViolations.add( new DummyConstraintViolation<ConstraintViolationExceptionTest>() ); ConstraintViolationException constraintViolationException = new ConstraintViolationException( constraintViolations ); assertEquals( constraintViolationException.getConstraintViolations(), constraintViolations ); }
@Test public void testCreationOfConstraintViolationExceptionWithMessage() { Set<ConstraintViolation<ConstraintViolationExceptionTest>> constraintViolations = new HashSet<ConstraintViolation<ConstraintViolationExceptionTest>>(); constraintViolations.add( new DummyConstraintViolation<ConstraintViolationExceptionTest>() ); String message = "constraint violations occurred"; ConstraintViolationException constraintViolationException = new ConstraintViolationException( message, constraintViolations ); assertEquals( constraintViolationException.getConstraintViolations(), constraintViolations ); assertEquals( constraintViolationException.getMessage(), message ); }
@Test public void testCreationOfConstraintViolationExceptionWithoutViolations() { ConstraintViolationException constraintViolationException = new ConstraintViolationException( null, null ); assertNull( constraintViolationException.getConstraintViolations() ); assertNull( constraintViolationException.getMessage() ); }