@SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test(expected = IllegalStateException.class) public void shouldRethrowAllOtherExceptions() throws Throwable { EasyMock.expect(mockFilterChain.filter(mockMethodParam)); EasyMock.expectLastCall().andThrow(new IllegalStateException()); mockControl.replay(); handler.invoke(null, method, NO_PARAM); }
@SuppressWarnings({"ThrowableInstanceNeverThrown"}) @Test public void shouldThrowAnImplementationNotFoundExceptionIfAClassCantBeLocated() throws Throwable { EasyMock.expect(mockFilterChain.filter(mockMethodParam)); EasyMock.expectLastCall().andThrow(new MatchNotFoundException()); mockControl.replay(); try { handler.invoke(null, method, NO_PARAM); fail(); } catch (ImplementationNotFoundException e) { mockControl.verify(); assertThat(e.getMessage(), equalTo("Could not find implementation for class [B")); } }