@Test(expected = ValidationException.class) public void testNoSuchPersonvalidation() { Long id = 1L; context.checking(new Expectations() { { oneOf(pMapper).execute(with(equalInternally(new FindByIdRequest("Person", 1L)))); will(returnValue(null)); } }); final ServiceActionContext currentContext = new ServiceActionContext(id, principalMock); sut.validate(currentContext); }
@SuppressWarnings("unchecked") @Override public void validate(final ServiceActionContext inActionContext) { Long id; try { id = (Long) inActionContext.getParams(); } catch (ClassCastException ex) { throw new ValidationException("Unable to retreive information expects a Person Id."); } Person user = pMapper.execute(new FindByIdRequest("Person", id)); if (user == null) { throw new ValidationException("Unable to retreive information Person does not exist."); } }
GetProfileInformationValidation implements ValidationStrategy<ServiceActionContext> { @SuppressWarnings("unchecked") @Override public void validate(final ServiceActionContext inActionContext) { Long id; try { id = (Long) inActionContext.getParams(); } catch (ClassCastException ex) { throw new ValidationException("Unable to retreive information expects a Person Id."); } Person user = pMapper.execute(new FindByIdRequest("Person", id)); if (user == null) { throw new ValidationException("Unable to retreive information Person does not exist."); } } }
GetProfileInformationValidation implements ValidationStrategy<ServiceActionContext> { @SuppressWarnings("unchecked") @Override public void validate(final ServiceActionContext inActionContext) { Long id; try { id = (Long) inActionContext.getParams(); } catch (ClassCastException ex) { throw new ValidationException("Unable to retreive information expects a Person Id."); } Person user = pMapper.execute(new FindByIdRequest("Person", id)); if (user == null) { throw new ValidationException("Unable to retreive information Person does not exist."); } } GetProfileInformationValidation(final FindByIdMapper<Person> inPersonMapper); }
GetProfileInformationValidation implements ValidationStrategy<ServiceActionContext> { @SuppressWarnings("unchecked") @Override public void validate(final ServiceActionContext inActionContext) { Long id; try { id = (Long) inActionContext.getParams(); } catch (ClassCastException ex) { throw new ValidationException("Unable to retreive information expects a Person Id."); } Person user = pMapper.execute(new FindByIdRequest("Person", id)); if (user == null) { throw new ValidationException("Unable to retreive information Person does not exist."); } } GetProfileInformationValidation(final FindByIdMapper<Person> inPersonMapper); @SuppressWarnings("unchecked") @Override void validate(final ServiceActionContext inActionContext); }
GetProfileInformationValidation implements ValidationStrategy<ServiceActionContext> { @SuppressWarnings("unchecked") @Override public void validate(final ServiceActionContext inActionContext) { Long id; try { id = (Long) inActionContext.getParams(); } catch (ClassCastException ex) { throw new ValidationException("Unable to retreive information expects a Person Id."); } Person user = pMapper.execute(new FindByIdRequest("Person", id)); if (user == null) { throw new ValidationException("Unable to retreive information Person does not exist."); } } GetProfileInformationValidation(final FindByIdMapper<Person> inPersonMapper); @SuppressWarnings("unchecked") @Override void validate(final ServiceActionContext inActionContext);  }