### Question:
ConstraintViolationFormat { public static <E> String format(final Set<ConstraintViolation<E>> constraintViolations) { notNull(constraintViolations, "constraintViolations must not be null"); Iterator<ConstraintViolation<E>> iterator = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); while (iterator.hasNext()) { ConstraintViolation<E> constraintViolation = iterator.next(); sb.append(constraintViolation.getRootBeanClass().getSimpleName()).append('.') .append(constraintViolation.getPropertyPath().toString()).append(' ') .append(constraintViolation.getMessage()); if (iterator.hasNext()) { sb.append(", "); } } return sb.toString(); } private  ConstraintViolationFormat(); static String format(final Set<ConstraintViolation<E>> constraintViolations);  }### Answer:
@Test public void format() { Set<ConstraintViolation<TestEntity>> constraintViolations = validator.validate(new TestEntity()); assertThat(ConstraintViolationFormat.format(constraintViolations)).isEqualTo("TestEntity.value must not be null"); }
@Test public void formatShouldFailForMissingValue() { assertThatNullPointerException().isThrownBy(() -> ConstraintViolationFormat.format(null)); }