assertEquals(ex, exception);
}
}
public void testFalseIf5xx() throws Exception {
FalseIfNotAvailable function = new FalseIfNotAvailable();
HttpResponse response = EasyMock.createMock(HttpResponse.class);
HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);
// Status code is called twice
expect(response.getStatusCode()).andReturn(503);
expect(response.getStatusCode()).andReturn(503);
// Get response gets called twice
expect(exception.getResponse()).andReturn(response);
expect(exception.getResponse()).andReturn(response);
// Get cause is called to determine the root cause
expect(exception.getCause()).andReturn(null);
replay(response);
replay(exception);
assertFalse(function.createOrPropagate(exception));
verify(response);
verify(exception);
}