Пример #1
0
  @Test
  public void testSetupChildListener() throws Exception {
    final Checker checker = new Checker();
    PackageObjectFactory factory =
        new PackageObjectFactory(
            new HashSet<String>(), Thread.currentThread().getContextClassLoader());
    checker.setModuleFactory(factory);

    Configuration config = new DefaultConfiguration(DebugAuditAdapter.class.getCanonicalName());
    checker.setupChild(config);
  }
Пример #2
0
  @Test
  public void testSetupChildExceptions() throws Exception {
    final Checker checker = new Checker();
    PackageObjectFactory factory =
        new PackageObjectFactory(
            new HashSet<String>(), Thread.currentThread().getContextClassLoader());
    checker.setModuleFactory(factory);

    Configuration config = new DefaultConfiguration("java.lang.String");
    try {
      checker.setupChild(config);
      fail("Exception is expected");
    } catch (CheckstyleException ex) {
      assertEquals("java.lang.String is not allowed as a child in Checker", ex.getMessage());
    }
  }