### Question:
TikaContentExtractor { public TikaContent extract(final InputStream in) { return extract(in, (javax.ws.rs.core.MediaType)null); } 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 testExtractionFromTextFileUsingPdfParserFails() { assertNull("Document should be null, it is not a PDF", extractor.extract(getClass().getResourceAsStream("/files/testTXT.txt"))); }
@Test public void testExtractionFromRtfFileUsingPdfParserWithoutMediaTypeValidationFails() { final TikaContentExtractor another = new TikaContentExtractor(new PDFParser(), false); assertNull("Document should be null, it is not a PDF", another.extract(getClass().getResourceAsStream("/files/testRTF.rtf"))); }
@Test public void testExtractionFromEncryptedPdfFails() { assertNull("Document should be null, it is encrypted", extractor.extract(getClass().getResourceAsStream("/files/testPDF.Encrypted.pdf"))); }
@Test public void testExtractionFromNullInputStreamFails() { assertNull("Document should be null, it is encrypted", extractor.extract((InputStream)null)); }