コード例 #1
0
  @Test(expectedExceptions = AluminumException.class)
  public void tryingToObtainConfigurationElementAfterClosingConfigurationShouldCauseException() {
    Configuration configuration = new DefaultConfiguration();
    configuration.close();

    configuration.getCache();
  }
コード例 #2
0
  @AfterMethod
  public void closeConfiguration() {
    if (configuration != null) {
      configuration.close();

      configuration = null;
    }
  }
コード例 #3
0
  @Test(dependsOnMethods = "parsersInsideParserPackagesShouldBeFound")
  public void configurationShouldDisableParsersWhenItIsClosed() {
    Configuration configuration = new DefaultConfiguration();

    TestParser parser = findParserOfType(configuration, TestParser.class);

    configuration.close();

    assert parser.getConfiguration() == null;
  }
コード例 #4
0
  @Test(dependsOnMethods = "configurationShouldInitialiseSerialisers")
  public void configurationShouldDisableSerialisersWhenItIsClosed() {
    Configuration configuration = new DefaultConfiguration();

    TestSerialiser serialiser = findSerialiserOfType(configuration, TestSerialiser.class);

    configuration.close();

    assert serialiser.getConfiguration() == null;
  }
コード例 #5
0
  @Test(dependsOnMethods = "configurationShouldInitialiseLibraries")
  public void configurationShouldDisableLibrariesWhenItIsClosed() {
    Configuration configuration = new DefaultConfiguration();

    TestLibrary library = findLibraryOfType(configuration, TestLibrary.class);

    configuration.close();

    assert library.getConfiguration() == null;
  }
コード例 #6
0
  @Test(dependsOnMethods = "configurationShouldInitialiseExpressionFactories")
  public void configurationShouldDisableExpressionFactoriesWhenItIsClosed() {
    Configuration configuration = new DefaultConfiguration();

    TestExpressionFactory expressionFactory =
        findExpressionFactoryOfType(configuration, TestExpressionFactory.class);

    configuration.close();

    assert expressionFactory.getConfiguration() == null;
  }
コード例 #7
0
  @Test(dependsOnMethods = "configurationShouldInitialiseCache")
  public void configurationShouldDisableCacheWhenItIsClosed() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(CACHE_CLASS, TestCache.class.getName());

    Configuration configuration = new DefaultConfiguration(parameters);

    TestCache cache = (TestCache) configuration.getCache();

    configuration.close();

    assert cache.getConfiguration() == null;
  }
コード例 #8
0
  @Test(dependsOnMethods = "configurationShouldInitialiseTemplateFinder")
  public void configurationShouldDisableTemplateFinderWhenItIsClosed() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(TEMPLATE_FINDER_CLASS, TestTemplateFinder.class.getName());

    Configuration configuration = new DefaultConfiguration(parameters);

    TestTemplateFinder templateFinder = (TestTemplateFinder) configuration.getTemplateFinder();

    configuration.close();

    assert templateFinder.getConfiguration() == null;
  }
コード例 #9
0
  @Test(dependsOnMethods = "configurationShouldInitialiseConverterRegistry")
  public void configurationShouldDisableConverterRegistryWhenItIsClosed() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(CONVERTER_REGISTRY_CLASS, TestConverterRegistry.class.getName());

    Configuration configuration = new DefaultConfiguration(parameters);

    TestConverterRegistry converterRegistry =
        (TestConverterRegistry) configuration.getConverterRegistry();

    configuration.close();

    assert converterRegistry.getConfiguration() == null;
  }
コード例 #10
0
  @Test(dependsOnMethods = "configurationShouldInitialiseTemplateElementFactory")
  public void configurationShouldDisableTemplateElementFactoryWhenItIsClosed() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(
        TEMPLATE_ELEMENT_FACTORY_CLASS, TestTemplateElementFactory.class.getName());

    Configuration configuration = new DefaultConfiguration(parameters);

    TestTemplateElementFactory templateElementFactory =
        (TestTemplateElementFactory) configuration.getTemplateElementFactory();

    configuration.close();

    assert templateElementFactory.getConfiguration() == null;
  }
コード例 #11
0
 @Test(expectedExceptions = AluminumException.class)
 public void closingAlreadyClosedConfigurationShouldCauseException() {
   Configuration configuration = new DefaultConfiguration();
   configuration.close();
   configuration.close();
 }