Пример #1
0
  @Test
  public void testCustomTikaParseContextProvider() throws Exception {
    bridgeUnderTest.setParseContextProviderClass(CustomTikaParseContextProvider.class);
    bridgeUnderTest.set(testFieldName, PATH_TO_TEST_DOCUMENT_PDF, testDocument, options);

    assertEquals(
        "The getParseContext method of the custom parse context provider should have been called",
        1,
        CustomTikaParseContextProvider.invocationCount);
  }
Пример #2
0
 @Test
 public void testUnknownTikaParseContextProvider() throws Exception {
   try {
     bridgeUnderTest.setParseContextProviderClass(this.getClass());
     fail();
   } catch (SearchException e) {
     assertEquals(
         "Wrong error message",
         "Wrong configuration of Tika metadata processor: class org.hibernate.search.test.bridge.builtin.TikaBridgeTest does not implement interface org.hibernate.search.bridge.TikaParseContextProvider",
         e.getMessage());
   }
 }