### Question:
TikaContentExtractor { public SearchBean extractMetadataToSearchBean(final InputStream in) { TikaContent tc = extractMetadata(in); if (tc == null) { return null; } Metadata metadata = tc.getMetadata(); SearchBean bean = new SearchBean(); for (final String property: metadata.names()) { bean.set(property, metadata.get(property)); } return bean; } TikaContentExtractor();  TikaContentExtractor(final Parser parser);  TikaContentExtractor(final List<Parser> parsers);  TikaContentExtractor(final List<Parser> parsers, Detector detector);  TikaContentExtractor(final Parser parser, final boolean validateMediaType); TikaContent extract(final InputStream in); TikaContent extract(final InputStream in, javax.ws.rs.core.MediaType mt); TikaContent extract(final InputStream in, final ContentHandler handler); TikaContent extract(final InputStream in, final ContentHandler handler,
                               javax.ws.rs.core.MediaType mt); TikaContent extract(final InputStream in, final ContentHandler handler, ParseContext context); TikaContent extract(final InputStream in, ContentHandler handler,
                               javax.ws.rs.core.MediaType mtHint, ParseContext context); TikaContent extractMetadata(final InputStream in); SearchBean extractMetadataToSearchBean(final InputStream in);  }### Answer:
@Test public void testExtractedTextContentMatchesSearchCriteria() throws Exception { SearchCondition<SearchBean> sc = parser.parse("Author==Bertrand*"); final SearchBean bean = extractor.extractMetadataToSearchBean( getClass().getResourceAsStream("/files/testPDF.pdf")); assertNotNull("Document should not be null", bean); assertTrue(sc.isMet(bean)); }
@Test public void testExtractedTextContentDoesNotMatchSearchCriteria() throws Exception { SearchCondition<SearchBean> sc = parser.parse("Author==Barry*"); final SearchBean bean = extractor.extractMetadataToSearchBean( getClass().getResourceAsStream("/files/testPDF.pdf")); assertNotNull("Document should not be null", bean); assertFalse(sc.isMet(bean)); }