ValidationUtils { public static void prefixValidationResultMessages(List<ValidationResult> results, String prefix) { for (ValidationResult result : results) { result.setMessage(prefix + ": " + result.getMessage()); } }  static boolean hasValidationFailures(List<ValidationResult> results); static void logValidationResults(List<ValidationResult> results); static void prefixValidationResultMessages(List<ValidationResult> results, String prefix);  }
@Test public void testPrefixValidationResultMessages() { List<ValidationResult> vrs = Lists.newArrayList( new ValidationResult(Validity.VALID, "hello"), new ValidationResult(Validity.INVALID, "world") ); ValidationUtils.prefixValidationResultMessages(vrs, "test"); assertEquals(vrs.get(0).getMessage(), "test: hello"); assertEquals(vrs.get(1).getMessage(), "test: world"); }