ValidationResult { private ValidationResult(boolean valid, String errorMessage, Object data) { this.valid = valid; this.errorMessage = errorMessage; this.data = data; } private  ValidationResult(boolean valid, String errorMessage, Object data); static ValidationResult OK(); static ValidationResult OK(final Object data); static ValidationResult KO(final String errorMessage); static ValidationResult KO(final String errorMessage, final Object data); static ValidationResult newValidationResult(final boolean valid, String errorMessage, final Object data); String getErrorMessage(); boolean isValid(); Object getData(); @Override String toString();  }
@Test public void testValidationResult() { final ValidationResult result = ValidationResult.newValidationResult(true, "Message", "Data"); Assert.assertTrue(result.isValid()); Assert.assertEquals("Message", result.getErrorMessage()); Assert.assertEquals("Data", result.getData()); Assert.assertEquals("ValidationResult{valid=true, errorMessage='Message', data=Data}", result.toString()); }