@Test(expected = ValidationException.class) public void testValidateFail() { final List<TabDTO> tabs = new ArrayList<TabDTO>(); tabs.add(tabDTO1); context.checking(new Expectations() { { oneOf(actionContext).getPrincipal(); will(returnValue(principalMock)); oneOf(principalMock).getId(); will(returnValue(principalId)); oneOf(personPagePropertiesByIdMapper).execute(principalId); will(returnValue(pppDto)); oneOf(pppDto).getTabDTOs(); will(returnValue(tabs)); } }); sut.validate(actionContext); context.assertIsSatisfied(); }
@Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { PersonPagePropertiesDTO result = personPagePropertiesByIdMapper.execute(inActionContext.getPrincipal().getId()); if (result.getTabDTOs().size() <= 1) { throw new ValidationException("Start page must have at least 1 tab."); } }
DeleteTabValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { PersonPagePropertiesDTO result = personPagePropertiesByIdMapper.execute(inActionContext.getPrincipal().getId()); if (result.getTabDTOs().size() <= 1) { throw new ValidationException("Start page must have at least 1 tab."); } } }
DeleteTabValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { PersonPagePropertiesDTO result = personPagePropertiesByIdMapper.execute(inActionContext.getPrincipal().getId()); if (result.getTabDTOs().size() <= 1) { throw new ValidationException("Start page must have at least 1 tab."); } } DeleteTabValidation(final DomainMapper<Long, PersonPagePropertiesDTO> inPersonPagePropertiesByIdMapper); }
DeleteTabValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { PersonPagePropertiesDTO result = personPagePropertiesByIdMapper.execute(inActionContext.getPrincipal().getId()); if (result.getTabDTOs().size() <= 1) { throw new ValidationException("Start page must have at least 1 tab."); } } DeleteTabValidation(final DomainMapper<Long, PersonPagePropertiesDTO> inPersonPagePropertiesByIdMapper); @Override void validate(final PrincipalActionContext inActionContext); }
DeleteTabValidation implements ValidationStrategy<PrincipalActionContext> { @Override public void validate(final PrincipalActionContext inActionContext) throws ValidationException { PersonPagePropertiesDTO result = personPagePropertiesByIdMapper.execute(inActionContext.getPrincipal().getId()); if (result.getTabDTOs().size() <= 1) { throw new ValidationException("Start page must have at least 1 tab."); } } DeleteTabValidation(final DomainMapper<Long, PersonPagePropertiesDTO> inPersonPagePropertiesByIdMapper); @Override void validate(final PrincipalActionContext inActionContext);  }