use of com.linkedin.restli.server.RequestExecutionReportBuilder in project rest.li by linkedin.
the class TestRestLiCallback method testOnSuccessNoFilters.
@Test
public void testOnSuccessNoFilters() throws Exception {
String result = "foo";
RequestExecutionReport executionReport = new RequestExecutionReportBuilder().build();
RestLiResponseAttachments restLiResponseAttachments = new RestLiResponseAttachments.Builder().build();
RestLiResponseData responseData = new RestLiResponseDataImpl(HttpStatus.S_200_OK, Collections.<String, String>emptyMap(), Collections.<HttpCookie>emptyList());
PartialRestResponse partialResponse = new PartialRestResponse.Builder().build();
RestResponse restResponse = new RestResponseBuilder().build();
// Set up.
when(_requestExecutionReportBuilder.build()).thenReturn(executionReport);
when(_responseHandler.buildRestLiResponseData(_restRequest, _routingResult, result)).thenReturn(responseData);
when(_responseHandler.buildPartialResponse(_routingResult, responseData)).thenReturn(partialResponse);
when(_responseHandler.buildResponse(_routingResult, partialResponse)).thenReturn(restResponse);
// Invoke.
_noFilterRestLiCallback.onSuccess(result, executionReport, restLiResponseAttachments);
// Verify.
verify(_responseHandler).buildPartialResponse(_routingResult, responseData);
verify(_responseHandler).buildRestLiResponseData(_restRequest, _routingResult, result);
verify(_responseHandler).buildResponse(_routingResult, partialResponse);
verify(_callback).onSuccess(restResponse, executionReport, restLiResponseAttachments);
verifyZeroInteractions(_restRequest, _routingResult);
verifyNoMoreInteractions(_responseHandler, _callback);
}
Aggregations