### Question:
HTTPTransformer { public static Request apiGatewayRequestToESRequest(@NonNull final APIGatewayProxyRequestEvent requestEvent) { final Request esRequest = new Request(requestEvent.getHttpMethod(), requestEvent.getPath()); Map<String,String> queryStringParams = requestEvent.getQueryStringParameters(); if(queryStringParams!=null) queryStringParams.forEach(esRequest::addParameter); esRequest.setJsonEntity(requestEvent.getBody()); return esRequest; }  static Request apiGatewayRequestToESRequest(@NonNull final APIGatewayProxyRequestEvent requestEvent); static APIGatewayProxyResponseEvent esResponseToAPIGatewayResponse(@NonNull final Response esResponse); static String transformHttpEntityToString(final HttpEntity entity);  }### Answer:
@Test public void correctRequestTransformFromGWToESWithEmptyBody() { when(mockGWRequest.getHttpMethod()).thenReturn(TestConstants.GET_METHOD); when(mockGWRequest.getPath()).thenReturn(Constants.CONFIG_PATH); when(mockGWRequest.getBody()).thenReturn(null); Request esRequest = HTTPTransformer.apiGatewayRequestToESRequest(mockGWRequest); assertEquals(TestConstants.GET_METHOD, esRequest.getMethod()); assertEquals(Constants.CONFIG_PATH, esRequest.getEndpoint()); assertNull(esRequest.getEntity()); }
@Test public void correctRequestTransformFromGWToES() throws IOException { when(mockGWRequest.getHttpMethod()).thenReturn(TestConstants.GET_METHOD); when(mockGWRequest.getPath()).thenReturn(Constants.CONFIG_PATH); when(mockGWRequest.getBody()).thenReturn(TestConstants.DUMMY_MESSAGE); Request esRequest = HTTPTransformer.apiGatewayRequestToESRequest(mockGWRequest); assertEquals(TestConstants.GET_METHOD, esRequest.getMethod()); assertEquals(Constants.CONFIG_PATH, esRequest.getEndpoint()); assertEquals(TestConstants.DUMMY_MESSAGE, EntityUtils.toString(esRequest.getEntity())); }