@Test public void testGoodValidation() { context.checking(new Expectations() { { allowing(actionContext).getParams(); will(returnValue(id)); allowing(findById).execute(with(any(FindByIdRequest.class))); will(returnValue(group)); } }); sut.validate(actionContext); context.assertIsSatisfied(); }
@Override public void validate(final ActionContext inActionContext) { DomainGroup group = findByIdDAO.execute(new FindByIdRequest("DomainGroup", ((Long) inActionContext.getParams()) .longValue())); if (null == group) { throw new ValidationException("Attempt to delete group that is no longer present"); } }
DeleteGroupValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) { DomainGroup group = findByIdDAO.execute(new FindByIdRequest("DomainGroup", ((Long) inActionContext.getParams()) .longValue())); if (null == group) { throw new ValidationException("Attempt to delete group that is no longer present"); } } }
DeleteGroupValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) { DomainGroup group = findByIdDAO.execute(new FindByIdRequest("DomainGroup", ((Long) inActionContext.getParams()) .longValue())); if (null == group) { throw new ValidationException("Attempt to delete group that is no longer present"); } } DeleteGroupValidation(final FindByIdMapper<DomainGroup> inFindByIdDAO); }
DeleteGroupValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) { DomainGroup group = findByIdDAO.execute(new FindByIdRequest("DomainGroup", ((Long) inActionContext.getParams()) .longValue())); if (null == group) { throw new ValidationException("Attempt to delete group that is no longer present"); } } DeleteGroupValidation(final FindByIdMapper<DomainGroup> inFindByIdDAO); @Override void validate(final ActionContext inActionContext); }
DeleteGroupValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) { DomainGroup group = findByIdDAO.execute(new FindByIdRequest("DomainGroup", ((Long) inActionContext.getParams()) .longValue())); if (null == group) { throw new ValidationException("Attempt to delete group that is no longer present"); } } DeleteGroupValidation(final FindByIdMapper<DomainGroup> inFindByIdDAO); @Override void validate(final ActionContext inActionContext);  }