### Question:
SessionPersistenceValidator implements ResourceValidator<SessionPersistence> { @Override public ValidatorResult validate(SessionPersistence persistence, Object httpRequestType) { ValidatorResult result = validator.validate(persistence, httpRequestType); return ValidatorUtilities.removeEmptyMessages(result); } SessionPersistenceValidator(); @Override ValidatorResult validate(SessionPersistence persistence, Object httpRequestType); @Override Validator<SessionPersistence> getValidator();  }### Answer:
@Test public void shouldAcceptWhenGivenAValidSessionPersistenceObject() { ValidatorResult result = validator.validate(sp, HttpRequestType.POST); assertTrue(result.passedValidation()); }
@Test public void shoudRejectANullSessionPersistenceObject() { sp.setPersistenceType(null); ValidatorResult result = validator.validate(sp, HttpRequestType.POST); assertFalse(result.passedValidation()); }
@Test public void shouldRejectWhenMissingPersistenceType() { sp.setPersistenceType(null); ValidatorResult result = validator.validate(sp, HttpRequestType.POST); assertFalse(result.passedValidation()); }