@Test
  public void testContentFilterCreation() throws Exception {
    assertEquals("", loader.loadContentFilter());
    assertEquals(null, SaveResponder.contentFilter);

    testProperties.setProperty(ComponentFactory.CONTENT_FILTER, TestContentFilter.class.getName());

    String content = loader.loadContentFilter();
    assertEquals(
        "\tContent filter installed: " + SaveResponder.contentFilter.getClass().getName() + "\n",
        content);
    assertNotNull(SaveResponder.contentFilter);
    assertEquals(TestContentFilter.class, SaveResponder.contentFilter.getClass());
  }
 @Test
 public void testMakeOneUserAuthenticator() throws Exception {
   Authenticator a = loader.makeAuthenticator("bob:uncle");
   assertTrue(a instanceof OneUserAuthenticator);
   OneUserAuthenticator oua = (OneUserAuthenticator) a;
   assertEquals("bob", oua.getUser());
   assertEquals("uncle", oua.getPassword());
 }
  @Test
  public void testAuthenticatorCustomCreation() throws Exception {
    testProperties.setProperty(ComponentFactory.AUTHENTICATOR, SimpleAuthenticator.class.getName());

    Authenticator authenticator = loader.getAuthenticator(new PromiscuousAuthenticator());
    assertNotNull(authenticator);
    assertEquals(SimpleAuthenticator.class, authenticator.getClass());
  }
 @Test
 public void testMakeMultiUserAuthenticator() throws Exception {
   final String passwordFilename = "testpasswd";
   File passwd = new File(passwordFilename);
   passwd.createNewFile();
   Authenticator a = loader.makeAuthenticator(passwordFilename);
   assertTrue(a instanceof MultiUserAuthenticator);
   passwd.delete();
 }
  @Test
  public void testWikiWidgetPlugins() throws Exception {
    String symbolValues = Today.class.getName();
    testProperties.setProperty(ComponentFactory.SYMBOL_TYPES, symbolValues);

    String output = loader.loadSymbolTypes(testProvider);

    assertSubString(Today.class.getName(), output);

    assertMatch("!today", true);
  }
  public void testCustomComparatorsCreation()
      throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    testProperties.setProperty(
        ComponentFactory.CUSTOM_COMPARATORS, "test:" + TestCustomComparator.class.getName());
    String content = loader.loadCustomComparators();

    assertTrue(content.contains("test:"));
    assertTrue(content.contains("TestCustomComparator"));

    CustomComparator customComparator =
        CustomComparatorRegistry.getCustomComparatorForPrefix("test");
    assertNotNull(customComparator);
    assertTrue(customComparator instanceof TestCustomComparator);
  }
  @Test
  public void testSlimTablesWithColonCreation() throws ClassNotFoundException {
    testProperties.setProperty(
        ComponentFactory.SLIM_TABLES, "test::" + TestSlimTable.class.getName());
    String content = loader.loadSlimTables();

    assertTrue(content.contains("test:"));
    assertTrue(content.contains("TestSlimTable"));

    HtmlTable table = makeMockTable("test:");
    SlimTable slimTable =
        new SlimTableFactory().makeSlimTable(table, "foo", new SlimTestContextImpl());
    assertSame(TestSlimTable.class, slimTable.getClass());
  }
  @Test
  public void testAddPlugins() throws Exception {
    testProperties.setProperty(ComponentFactory.PLUGINS, DummyPlugin.class.getName());

    FileSystemPageFactory wikiPageFactory = new FileSystemPageFactory();
    ResponderFactory responderFactory = new ResponderFactory(".");

    assertMatch("!today", false);

    String output = loader.loadPlugins(responderFactory, testProvider);

    assertSubString(DummyPlugin.class.getName(), output);

    assertEquals(WikiPageResponder.class, responderFactory.getResponderClass("custom1"));
    assertEquals(EditResponder.class, responderFactory.getResponderClass("custom2"));
    assertMatch("!today", true);
  }
  @Test
  public void testAddResponderPlugins() throws Exception {
    String respondersValue =
        "custom1:"
            + WikiPageResponder.class.getName()
            + ",custom2:"
            + EditResponder.class.getName();
    testProperties.setProperty(ComponentFactory.RESPONDERS, respondersValue);

    ResponderFactory responderFactory = new ResponderFactory(".");
    String output = loader.loadResponders(responderFactory);

    assertSubString("custom1:" + WikiPageResponder.class.getName(), output);
    assertSubString("custom2:" + EditResponder.class.getName(), output);

    assertEquals(WikiPageResponder.class, responderFactory.getResponderClass("custom1"));
    assertEquals(EditResponder.class, responderFactory.getResponderClass("custom2"));
  }
 @Test
 public void testMakeNullAuthenticator() throws Exception {
   Authenticator a = loader.makeAuthenticator(null);
   assertTrue(a instanceof PromiscuousAuthenticator);
 }
 @Test
 public void testAuthenticatorDefaultCreation() throws Exception {
   Authenticator authenticator = loader.getAuthenticator(new PromiscuousAuthenticator());
   assertNotNull(authenticator);
   assertEquals(PromiscuousAuthenticator.class, authenticator.getClass());
 }