@Test void deserializerShouldNotThrowWhenMoreThanOneNode() throws Exception { TikaTextExtractor textExtractor = new TikaTextExtractor( new RecordingMetricFactory(), (inputStream, contentType) -> Optional.of(new ByteArrayInputStream(("[{\"X-TIKA:content\": \"This is an awesome LibreOffice document !\"}, " + "{\"Chroma BlackIsZero\": \"true\"}]") .getBytes(StandardCharsets.UTF_8)))); InputStream inputStream = null; textExtractor.extractContent(inputStream, ContentType.of("text/plain")); }
@Override public ParsedContent extractContent(InputStream inputStream, ContentType contentType) throws Exception { if (contentType.mediaType().equals(TEXT)) { return jsoupTextExtractor.extractContent(inputStream, contentType); } return metricFactory.decorateSupplierWithTimerMetric("tikaTextExtraction", Throwing.supplier( () -> performContentExtraction(inputStream, contentType)) .sneakyThrow()); }
TikaTextExtractor implements TextExtractor { @Override public ParsedContent extractContent(InputStream inputStream, ContentType contentType) throws Exception { if (contentType.mediaType().equals(TEXT)) { return jsoupTextExtractor.extractContent(inputStream, contentType); } return metricFactory.decorateSupplierWithTimerMetric("tikaTextExtraction", Throwing.supplier( () -> performContentExtraction(inputStream, contentType)) .sneakyThrow()); } }
TikaTextExtractor implements TextExtractor { @Override public ParsedContent extractContent(InputStream inputStream, ContentType contentType) throws Exception { if (contentType.mediaType().equals(TEXT)) { return jsoupTextExtractor.extractContent(inputStream, contentType); } return metricFactory.decorateSupplierWithTimerMetric("tikaTextExtraction", Throwing.supplier( () -> performContentExtraction(inputStream, contentType)) .sneakyThrow()); } @Inject  TikaTextExtractor(MetricFactory metricFactory, TikaHttpClient tikaHttpClient); }
TikaTextExtractor implements TextExtractor { @Override public ParsedContent extractContent(InputStream inputStream, ContentType contentType) throws Exception { if (contentType.mediaType().equals(TEXT)) { return jsoupTextExtractor.extractContent(inputStream, contentType); } return metricFactory.decorateSupplierWithTimerMetric("tikaTextExtraction", Throwing.supplier( () -> performContentExtraction(inputStream, contentType)) .sneakyThrow()); } @Inject  TikaTextExtractor(MetricFactory metricFactory, TikaHttpClient tikaHttpClient); @Override ParsedContent extractContent(InputStream inputStream, ContentType contentType); ParsedContent performContentExtraction(InputStream inputStream, ContentType contentType); }
TikaTextExtractor implements TextExtractor { @Override public ParsedContent extractContent(InputStream inputStream, ContentType contentType) throws Exception { if (contentType.mediaType().equals(TEXT)) { return jsoupTextExtractor.extractContent(inputStream, contentType); } return metricFactory.decorateSupplierWithTimerMetric("tikaTextExtraction", Throwing.supplier( () -> performContentExtraction(inputStream, contentType)) .sneakyThrow()); } @Inject  TikaTextExtractor(MetricFactory metricFactory, TikaHttpClient tikaHttpClient); @Override ParsedContent extractContent(InputStream inputStream, ContentType contentType); ParsedContent performContentExtraction(InputStream inputStream, ContentType contentType);  }