@Test(expected = ParameterValidatorException.class)
 public void testSinglePatternSensitive() throws ParameterValidatorException {
   validator.setPattern("[a-m]+");
   validator.setCaseInsensitive(false);
   mockReq.addParameterValue("test", "AMMA");
   validator.validate(mockReq, "test");
 }
 @Test
 public void testSinglePatternMatch() throws ParameterValidatorException {
   validator.setPattern("[a-m]+");
   mockReq.addParameterValue("test", "amma");
   validator.validate(mockReq, "test");
   Assert.assertEquals("amma", requestObject.getStringMember());
 }
 @Test(expected = ParameterValidatorException.class)
 public void testTooLong() throws ParameterValidatorException {
   validator.setMaxLength(2);
   validator.setCaseInsensitive(false);
   mockReq.addParameterValue("test", "AAA");
   validator.validate(mockReq, "test");
 }
 @Test
 public void testSinglePatternInsensitive2() throws ParameterValidatorException {
   validator.setCaseInsensitive(true);
   validator.setPattern("[a-m]+");
   mockReq.addParameterValue("test", "AMMA");
   validator.validate(mockReq, "test");
   Assert.assertEquals("AMMA", requestObject.getStringMember());
 }
 @Test
 public void testRightSize() throws ParameterValidatorException {
   validator.setMinLength(2);
   validator.setMaxLength(2);
   validator.setCaseInsensitive(false);
   mockReq.addParameterValue("test", "AA");
   validator.validate(mockReq, "test");
 }
 @Test(expected = ParameterValidatorException.class)
 public void testMultiplePatternFail() throws ParameterValidatorException {
   ArrayList<String> patterns = new ArrayList<String>();
   patterns.add("one");
   patterns.add("two");
   patterns.add("three");
   validator.setPatterns(patterns);
   mockReq.addParameterValue("test", "four");
   validator.validate(mockReq, "test");
 }
 @Test
 public void testMultiplePatternMatch() throws ParameterValidatorException {
   ArrayList<String> patterns = new ArrayList<String>();
   patterns.add("one");
   patterns.add("two");
   patterns.add("three");
   validator.setPatterns(patterns);
   mockReq.addParameterValue("test", "two");
   validator.validate(mockReq, "test");
   Assert.assertEquals("two", requestObject.getStringMember());
 }
 @Before
 public void init() {
   mockReq = new MockServletRequestFacade(new MockHttpServletRequest());
   state = new RequestState(null);
   requestObject = new ValidatorTestBean();
   state.setRequestObject(requestObject);
   mockReq.setAttribute(Constants.REQUEST_STATE, state);
   validator = new ParameterTypeString();
   validator.setName("test");
   validator.setRequired(true);
   validator.setMember("stringMember");
 }
 @Test(expected = ParameterValidatorException.class)
 public void testSinglePatternFail() throws ParameterValidatorException {
   validator.setPattern("[a-m]+");
   mockReq.addParameterValue("test", "nosir");
   validator.validate(mockReq, "test");
 }
 @Test
 public void testEmptySuccess() throws ParameterValidatorException {
   mockReq.addParameterValue("test", "");
   validator.validate(mockReq, "test");
   Assert.assertEquals("", requestObject.getStringMember());
 }