@Test public void testIndexingMetadata() { bridgeUnderTest.setMetadataProcessorClass(CustomTikaMetadataProcessor.class); bridgeUnderTest.set(testFieldName, PATH_TO_TEST_DOCUMENT_PDF, testDocument, options); assertEquals( "The content type should have been indexed", "application/pdf", testDocument.get("type")); }
@Test public void testPrepareMetadata() { bridgeUnderTest.setMetadataProcessorClass(CustomTikaMetadataProcessor.class); bridgeUnderTest.set(testFieldName, PATH_TO_TEST_DOCUMENT_PDF, testDocument, options); assertEquals( "The set method of the custom metadata processor should have been called", 1, CustomTikaMetadataProcessor.invocationCount); }
@Test public void testUnknownTikaMetadataProcessor() throws Exception { try { bridgeUnderTest.setMetadataProcessorClass(this.getClass()); fail(); } catch (SearchException e) { assertEquals( "Wrong error message", "Wrong configuration of Tika parse context provider: class org.hibernate.search.test.bridge.builtin.TikaBridgeTest does not implement interface org.hibernate.search.bridge.TikaMetadataProcessor", e.getMessage()); } }