String response2,
ProtocolVersion protocolVersion,
String errorResponseHeaderName) throws Exception
{
final RestRequest request = buildRequest(acceptTypeData.acceptHeaders, protocolVersion);
AugmentedRestLiResponseData responseData;
RoutingResult routingResult1 = buildRoutingResultAction(Status.class, request, acceptTypeData.acceptHeaders);
// #1 simple record template
responseData = _responseHandler.buildRestLiResponseData(request, routingResult1, buildStatusRecord());
checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, true, errorResponseHeaderName);
assertEquals(responseData.getEntityResponse().toString(), response1);
// #2 DataTemplate response
StringMap map = new StringMap();
map.put("key1", "value1");
map.put("key2", "value2");
RoutingResult routingResult2 = buildRoutingResultAction(StringMap.class, request, acceptTypeData.acceptHeaders);
responseData = _responseHandler.buildRestLiResponseData(request, routingResult2, map);
checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, true, errorResponseHeaderName);
String actual = responseData.getEntityResponse().toString();
assertEquals(actual, response2);
RoutingResult routingResult3 = buildRoutingResultAction(Void.TYPE, request, acceptTypeData.acceptHeaders);
// #3 empty response
responseData =
_responseHandler.buildRestLiResponseData(request, routingResult3, null);
checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, false, errorResponseHeaderName);
assertEquals(responseData.getEntityResponse(), null);
}