@Test
    public void testEncryptedRar() throws Exception {
        Parser parser = new RarParser();

        try (InputStream input = getResourceAsStream("/test-documents/test-documents-enc.rar")) {
            Metadata metadata = new Metadata();
            ContentHandler handler = new BodyContentHandler();
            ParseContext context = new ParseContext();
            context.set(PasswordProvider.class, new PasswordProvider() {
                @Override
                public String getPassword(Metadata metadata) {
                    return "ApacheTika";
                }
            });

            // Note - we don't currently support encrypted RAR
            // files so we can't check the contents
            parser.parse(input, handler, metadata, trackingContext);
            fail("No support yet for Encrypted RAR files");
        } catch (EncryptedDocumentException e) {
            // Good, as expected right now
        }
    }
Note - we don't currently support Encrypted RAR files,
so all we can do is throw a helpful exception
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/test/java/org/apache/tika/parser/pkg/RarParserTest.java