HandlerKeyValidator { public void validateGeneratedKey(final String handlerKey, final String handlerClassName) { if (handlerKey == null || (handlerKey.contains(SequenceConstants.SEQUENCE_KEY_SEPARATOR.getConstant()) || handlerKey.contains(SequenceConstants.SEQUENCE_ID_SEPARATOR.getConstant()))) { throw new SequenceHandlerKeyValidationException(handlerKey + " is not valid, handler(" + handlerClassName + "). Forbidden charaters: " + SequenceConstants.SEQUENCE_KEY_SEPARATOR.getConstant() + " " + SequenceConstants.SEQUENCE_ID_SEPARATOR.getConstant()); } }  void validateGeneratedKey(final String handlerKey, final String handlerClassName);  }
@Test(expectedExceptions = SequenceHandlerKeyValidationException.class) public void testCheckRequestShouldThrowValidationExceptionWhenHandlerKeyContainsForbiddenCharacterVerticalbar() { String generatedKey = "test|Key2"; underTest.validateGeneratedKey(generatedKey, HANDLER_NAME); }
@Test(expectedExceptions = SequenceHandlerKeyValidationException.class) public void testCheckRequestShouldThrowValidationExceptionWhenHandlerKeyContainsForbiddenCharacterSemicolon() { String generatedKey = "testKey;2"; underTest.validateGeneratedKey(generatedKey, HANDLER_NAME); }
@Test(expectedExceptions = SequenceHandlerKeyValidationException.class) public void testCheckRequestShouldThrowValidationExceptionWhenHandlerKeyIsNull() { underTest.validateGeneratedKey(null, HANDLER_NAME); }