### Question:
RegexMatcher implements ValueConverter<String> { public String convert( String value ) { if ( !pattern.matcher( value ).matches() ) { raiseValueConversionFailure( value ); } return value; } RegexMatcher( String pattern, int flags ); static ValueConverter<String> regex( String pattern ); String convert( String value ); Class<String> valueType(); String valuePattern();  }### Answer:
@Test public void shouldAttemptToMatchValueAgainstARegex() { assertEquals( "abc", abc.convert( "abc" ) ); }
@Test( expected = ValueConversionException.class ) public void rejectsValueThatDoesNotMatchRegex() { abc.convert( "abcd" ); }
@Test public void raisesExceptionContainingValueAndPattern() { thrown.expect( ValueConversionException.class ); thrown.expectMessage( "\\d+" ); thrown.expectMessage( "asdf" ); new RegexMatcher( "\\d+", 0 ).convert( "asdf" ); }