ValidationResultImpl implements ValidationResult { public static ValidationResult create(ValidationResult result) { if (result == null) { result = SUCCESS; } return new ValidationResultImpl(result.isValid(), result.getDetail()); } ValidationResultImpl(boolean valid, String detail); @Override boolean isValid(); @Override String getDetail(); static ValidationResult create(ValidationResult result);  }
@Test public void testCreate() throws Exception { ValidationResult result = ValidationResultImpl.create(new ValidationResultImpl(true, "is true")); Assert.assertTrue(result.isValid()); Assert.assertEquals("is true", result.getDetail()); result = ValidationResultImpl.create(new ValidationResultImpl(false, "is false")); Assert.assertFalse(result.isValid()); Assert.assertEquals("is false", result.getDetail()); }