### Question:
PasswordChangeRequest extends DefaultBaseEntity { public void setCode(final String code) { this.code = code; }  UUID getUserId(); void setUser(final SecurityUser user); String getCode(); void setCode(final String code);  }### Answer:
@Test public void testValidateNullCode() { final PasswordChangeRequest pcr = new PasswordChangeRequest(); pcr.setCode(null); assertEquals(1, validator.validate(pcr).size()); }
@Test public void testValidateEmptyCode() { final PasswordChangeRequest pcr = new PasswordChangeRequest(); pcr.setCode(""); assertEquals(2, validator.validate(pcr).size()); }
@Test public void testValidateTooShortCode() { final PasswordChangeRequest pcr = new PasswordChangeRequest(); pcr.setCode("01234567890123456789"); assertEquals(2, validator.validate(pcr).size()); }