InfrastructureErrorBundle implements ErrorBundle { @Override public Exception getException() { return exception; } InfrastructureErrorBundle(Exception exception); @Override Exception getException(); @Override String getErrorMessage();  }
@Test public void shouldReturnTheRightException() throws Exception { Exception exception = infrastructureErrorBundle.getException(); assertThat(exception, notNullValue()); assertThat(exception, is(instanceOf(Exception.class))); assertThat(exception, is(mockException)); }
@Test public void shouldReturnNullExceptionGivenANullException() throws Exception { InfrastructureErrorBundle infrastructureErrorBundleWithNullException = new InfrastructureErrorBundle(null); Exception exception = infrastructureErrorBundleWithNullException.getException(); assertThat(exception, nullValue()); }