test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/command/DefaultsTest.java
test_class.identifier: DefaultsTest
test_case.body: @Test
      public void shouldReadJsonResponse_ioException() throws Exception {
          // Given
          final ObjectMapper mapper = new ObjectMapper();
          final BasicHttpResponse httpResponse = buildResponse();
          httpResponse.setEntity(new StringEntity("") {
  
              @Override
              public InputStream getContent() throws IOException {
                  throw new IOException();
              }
          });
  
          // When
          try {
              Defaults.convertResponse(mapper, Response.class).apply(buildRequest(), httpResponse);
          } catch (TDPException e) {
              // Then
              assertEquals(CommonErrorCodes.UNEXPECTED_EXCEPTION, e.getCode());
          }
      }
test_case.class_method_signature: DefaultsTest.shouldReadJsonResponse_ioException()
test_case.full_signature: @Test public void shouldReadJsonResponse_ioException()
test_case.identifier: shouldReadJsonResponse_ioException
test_case.invocations: buildResponse setEntity apply convertResponse buildRequest assertEquals getCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldReadJsonResponse_ioException()
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/command/Defaults.java
focal_class.identifier: Defaults
focal_class.class_method_signature: Defaults.Defaults()
focal_class.full_signature: private  Defaults()
focal_class.identifier: Defaults
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  Defaults()
focal_class.class_method_signature: Defaults.passthrough()
focal_class.full_signature: public static Function<Exception, RuntimeException> passthrough()
focal_class.identifier: passthrough
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Function<Exception, RuntimeException>
focal_class.signature: Function<Exception, RuntimeException> passthrough()
focal_class.class_method_signature: Defaults.asNull()
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, T> asNull()
focal_class.identifier: asNull
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> asNull()
focal_class.class_method_signature: Defaults.asString()
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, String> asString()
focal_class.identifier: asString
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, String>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, String> asString()
focal_class.class_method_signature: Defaults.emptyString()
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, String> emptyString()
focal_class.identifier: emptyString
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, String>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, String> emptyString()
focal_class.class_method_signature: Defaults.emptyStream()
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, InputStream> emptyStream()
focal_class.identifier: emptyStream
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, InputStream>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, InputStream> emptyStream()
focal_class.class_method_signature: Defaults.pipeStream()
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, InputStream> pipeStream()
focal_class.identifier: pipeStream
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, InputStream>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, InputStream> pipeStream()
focal_class.class_method_signature: Defaults.convertResponse(ObjectMapper mapper,
              Class<T> clazz)
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              Class<T> clazz)
focal_class.identifier: convertResponse
focal_class.modifiers: public static
focal_class.parameters: (ObjectMapper mapper,
              Class<T> clazz)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              Class<T> clazz)
focal_class.class_method_signature: Defaults.convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference)
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference)
focal_class.identifier: convertResponse
focal_class.modifiers: public static
focal_class.parameters: (ObjectMapper mapper,
              TypeReference<T> typeReference)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference)
focal_class.class_method_signature: Defaults.convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference, Function<Exception, T> errorHandler)
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference, Function<Exception, T> errorHandler)
focal_class.identifier: convertResponse
focal_class.modifiers: public static
focal_class.parameters: (ObjectMapper mapper,
              TypeReference<T> typeReference, Function<Exception, T> errorHandler)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              TypeReference<T> typeReference, Function<Exception, T> errorHandler)
focal_class.class_method_signature: Defaults.toJson(ObjectMapper mapper)
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, JsonNode> toJson(ObjectMapper mapper)
focal_class.identifier: toJson
focal_class.modifiers: public static
focal_class.parameters: (ObjectMapper mapper)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, JsonNode>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, JsonNode> toJson(ObjectMapper mapper)
focal_class.class_method_signature: Defaults.iterate(Class<T> clazz, ObjectMapper mapper,
              Function<Iterator<T>, S> convert)
focal_class.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, S> iterate(Class<T> clazz, ObjectMapper mapper,
              Function<Iterator<T>, S> convert)
focal_class.identifier: iterate
focal_class.modifiers: public static
focal_class.parameters: (Class<T> clazz, ObjectMapper mapper,
              Function<Iterator<T>, S> convert)
focal_class.return: BiFunction<HttpRequestBase, HttpResponse, S>
focal_class.signature: BiFunction<HttpRequestBase, HttpResponse, S> iterate(Class<T> clazz, ObjectMapper mapper,
              Function<Iterator<T>, S> convert)
focal_class.class_method_signature: Defaults.getResponseEntity(HttpStatus status, HttpResponse response)
focal_class.full_signature: public static ResponseEntity<String> getResponseEntity(HttpStatus status, HttpResponse response)
focal_class.identifier: getResponseEntity
focal_class.modifiers: public static
focal_class.parameters: (HttpStatus status, HttpResponse response)
focal_class.return: ResponseEntity<String>
focal_class.signature: ResponseEntity<String> getResponseEntity(HttpStatus status, HttpResponse response)
focal_method.body: public static <T> BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              Class<T> clazz) {
          return (request, response) -> {
              try (final InputStream content = response.getEntity().getContent()) {
                  final String contentAsString = IOUtils.toString(content, UTF_8);
                  if (StringUtils.isEmpty(contentAsString)) {
                      return null;
                  } else {
                      return mapper.readerFor(clazz).readValue(contentAsString);
                  }
              } catch (IOException e) {
                  throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e);
              } finally {
                  request.releaseConnection();
              }
          };
      }
focal_method.class_method_signature: Defaults.convertResponse(ObjectMapper mapper,
              Class<T> clazz)
focal_method.full_signature: public static BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              Class<T> clazz)
focal_method.identifier: convertResponse
focal_method.invocations: getContent getEntity toString isEmpty readValue readerFor releaseConnection
focal_method.modifiers: public static
focal_method.parameters: (ObjectMapper mapper,
              Class<T> clazz)
focal_method.return: BiFunction<HttpRequestBase, HttpResponse, T>
focal_method.signature: BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
              Class<T> clazz)