@Test public void whenDoesNotRecognize() { ersForType = new ExceptionRecognizerForType(FooException.class); assertThat(ersForType.recognize(new BarException()), is(nullValue())); }
public ExceptionRecognizerForType(Category category, final Class<? extends Exception> exceptionType, final Function<String,String> messageParser) { this(category, ofType(exceptionType), messageParser); }
@Test public void whenRecognized() { ersForType = new ExceptionRecognizerForType(FooException.class); assertThat(ersForType.recognize(new FooException()), is("foo")); }
@Test public void whenRecognizedWithMessageParser() { ersForType = new ExceptionRecognizerForType(FooException.class, prepend); assertThat(ersForType.recognize(new FooException()), is("pre: foo")); }