Search in sources :

Example 11 with FileConfiguration

use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.

the class ExtensionParamUnitTest method shouldHaveLoadedConfigsAfterCloning.

@Test
public void shouldHaveLoadedConfigsAfterCloning() {
    // Given
    ExtensionParam param = new ExtensionParam();
    FileConfiguration config = createTestConfig(false, true, false);
    param.load(config);
    // When
    ExtensionParam clone = param.clone();
    // Then
    assertThat(clone.isExtensionEnabled("Extension 1"), is(equalTo(false)));
    assertThat(clone.isExtensionEnabled("Extension 2"), is(equalTo(true)));
    assertThat(clone.isExtensionEnabled("Extension 3"), is(equalTo(false)));
}
Also used : FileConfiguration(org.apache.commons.configuration.FileConfiguration) Test(org.junit.Test)

Example 12 with FileConfiguration

use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.

the class AbstractParamUnitTest method shouldHaveLoadedConfigsAfterCloning.

@Test
public void shouldHaveLoadedConfigsAfterCloning() {
    // Given
    TestAbstractParam param = createTestAbstractParam();
    FileConfiguration config = createTestConfig();
    param.load(config);
    // When
    TestAbstractParam clone = param.clone();
    // Then
    assertThat(clone, is(not(equalTo(null))));
    assertThat(clone.getValue(), is(equalTo(VALUE)));
    assertThat(clone.getValues(), is(equalTo(VALUES)));
}
Also used : FileConfiguration(org.apache.commons.configuration.FileConfiguration) Test(org.junit.Test)

Example 13 with FileConfiguration

use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.

the class AbstractParamUnitTest method shouldParseLoadedFileConfiguration.

@Test
public void shouldParseLoadedFileConfiguration() {
    // Given
    TestAbstractParam param = createTestAbstractParam();
    FileConfiguration config = createTestConfig();
    // When
    param.load(config);
    // Then
    assertThat(param.getValue(), is(equalTo(VALUE)));
    assertThat(param.getValues(), is(equalTo(VALUES)));
}
Also used : FileConfiguration(org.apache.commons.configuration.FileConfiguration) Test(org.junit.Test)

Aggregations

FileConfiguration (org.apache.commons.configuration.FileConfiguration)13 Test (org.junit.Test)10 ConfigurationException (org.apache.commons.configuration.ConfigurationException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 FileNotFoundException (java.io.FileNotFoundException)1 MalformedURLException (java.net.MalformedURLException)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 FileChangedReloadingStrategy (org.apache.commons.configuration.reloading.FileChangedReloadingStrategy)1 RegexAutoTagScanner (org.zaproxy.zap.extension.pscan.scanner.RegexAutoTagScanner)1