### Question:
HTTPTransformer { public static String transformHttpEntityToString(final HttpEntity entity) throws InternalErrorException { if (entity == null) { throw new InternalErrorException(CustomerMessage.INPUT_NULL_OR_EMPTY_ERROR); } try { return EntityUtils.toString(entity); } catch (IOException e) { throw new InternalErrorException(CustomerMessage.INTERNAL_ERROR, e); } }  static Request apiGatewayRequestToESRequest(@NonNull final APIGatewayProxyRequestEvent requestEvent); static APIGatewayProxyResponseEvent esResponseToAPIGatewayResponse(@NonNull final Response esResponse); static String transformHttpEntityToString(final HttpEntity entity);  }### Answer:
@Test public void correctTransformFromHttpEntityToString() throws InternalErrorException, UnsupportedEncodingException { HttpEntity entity = new NStringEntity(TestConstants.DUMMY_MESSAGE); String result = HTTPTransformer.transformHttpEntityToString(entity); assertEquals(TestConstants.DUMMY_MESSAGE, result); }
@Test public void failedTransformFromHttpEntityToStringEntityNull() { try { HTTPTransformer.transformHttpEntityToString(null); } catch (InternalErrorException e) { Assert.assertEquals(CustomerMessage.INPUT_NULL_OR_EMPTY_ERROR, e.getMessage()); } }
@Test public void failedTransformFromHttpEntityToString() throws IOException { mockStatic(EntityUtils.class); when(EntityUtils.toString(any(HttpEntity.class))).thenThrow(IOException.class); HttpEntity entity = new NStringEntity(TestConstants.DUMMY_MESSAGE); try { HTTPTransformer.transformHttpEntityToString(entity); } catch (InternalErrorException e) { assertEquals(CustomerMessage.INTERNAL_ERROR, e.getMessage()); } }