### Question:
ValidationResults { public static ValidationResult createInvalid(String errorDescription) { logger.warn(errorDescription); return new ValidationResultImpl(errorDescription); } private  ValidationResults(); static ValidationResult createInvalid(String errorDescription); static ValidationResult createInvalid(String errorDescriptionTemplate, Object... arguments); static ValidationResult createValid();  }### Answer:
@Test public void createInvalid() { String errorMessage = "An error message"; ValidationResult validationResult = ValidationResults.createInvalid(errorMessage); assertThat(validationResult.isErroneous()).isTrue(); assertThat(validationResult.getErrorDescription()).isEqualTo(errorMessage); }
@Test public void createInvalidWithTemplateString() { String errorMessageTemplate = "An error message {} {} {}"; String[] args = { "first", "second", "third" }; ValidationResult validationResult = ValidationResults.createInvalid(errorMessageTemplate, args[0], args[1], args[2]); assertThat(validationResult.isErroneous()).isTrue(); assertThat(validationResult.getErrorDescription()).isEqualTo("An error message first second third"); }
@Test public void createInvalidWithTemplateString_tooManyPlaceholders_areIgnored() { String errorMessageTemplate = "An error message {} {} {}"; String onlyOne = "first"; ValidationResult validationResult = ValidationResults.createInvalid(errorMessageTemplate, onlyOne); assertThat(validationResult.isErroneous()).isTrue(); assertThat(validationResult.getErrorDescription()).isEqualTo("An error message first {} {}"); }
@Test public void createInvalidWithTemplateString_tooManyArguments_areIgnored() { String errorMessageTemplate = "An error message {}"; String[] args = { "first", "second", "third" }; ValidationResult validationResult = ValidationResults.createInvalid(errorMessageTemplate, args); assertThat(validationResult.isErroneous()).isTrue(); assertThat(validationResult.getErrorDescription()).isEqualTo("An error message first"); }