throw new UnexpectedMajorExceptionHandlingError( "Unexpected major error in " + this.getClass().getName() + ". We had an inner exception while trying " + "to handle the original controller exception. This needs to be fixed ASAP. "
@Test(expected = UnexpectedMajorErrorHandlingError.class) public void maybeHandleErrorExplosionThrowsUnexpectedMajorErrorHandlingError() throws UnexpectedMajorExceptionHandlingError, UnexpectedMajorErrorHandlingError { UnexpectedMajorExceptionHandlingError innerExplosion = new UnexpectedMajorExceptionHandlingError("intentional kaboom", new Exception()); doThrow(innerExplosion).when(adapterSpy).maybeHandleException(any(Throwable.class), any(RequestInfoForLogging.class)); RequestInfo requestInfoMock = mock(RequestInfo.class); adapterSpy.maybeHandleError(new Exception(), requestInfoMock); } }