@Test(expected = ValidationException.class) public void testValidateTabNameToLong() { context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(renameRequestMock)); oneOf(renameRequestMock).getTabName(); will(returnValue(ValidationTestHelper.generateString(TabTemplate.MAX_TAB_NAME_LENGTH + 1))); } }); try { sut.validate(actionContext); } catch (ValidationException ve) { context.assertIsSatisfied(); assertEquals(ve.getMessage(), TabTemplate.MAX_TAB_NAME_MESSAGE); throw ve; } }
@Override public void validate(final ActionContext inActionContext) throws ValidationException { if (((RenameTabRequest) inActionContext.getParams()).getTabName().length() > TabTemplate.MAX_TAB_NAME_LENGTH) { throw new ValidationException(TabTemplate.MAX_TAB_NAME_MESSAGE); } }
RenameTabValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) throws ValidationException { if (((RenameTabRequest) inActionContext.getParams()).getTabName().length() > TabTemplate.MAX_TAB_NAME_LENGTH) { throw new ValidationException(TabTemplate.MAX_TAB_NAME_MESSAGE); } } }
RenameTabValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) throws ValidationException { if (((RenameTabRequest) inActionContext.getParams()).getTabName().length() > TabTemplate.MAX_TAB_NAME_LENGTH) { throw new ValidationException(TabTemplate.MAX_TAB_NAME_MESSAGE); } }  }
RenameTabValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) throws ValidationException { if (((RenameTabRequest) inActionContext.getParams()).getTabName().length() > TabTemplate.MAX_TAB_NAME_LENGTH) { throw new ValidationException(TabTemplate.MAX_TAB_NAME_MESSAGE); } }  @Override void validate(final ActionContext inActionContext); }
RenameTabValidation implements ValidationStrategy<ActionContext> { @Override public void validate(final ActionContext inActionContext) throws ValidationException { if (((RenameTabRequest) inActionContext.getParams()).getTabName().length() > TabTemplate.MAX_TAB_NAME_LENGTH) { throw new ValidationException(TabTemplate.MAX_TAB_NAME_MESSAGE); } }  @Override void validate(final ActionContext inActionContext);  }