use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.
the class ExtensionParamUnitTest method shouldHaveLoadedConfigsAfterCloning.
@Test
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)));
}
use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.
the class ExtensionParamUnitTest method shouldParseLoadedFileConfiguration.
@Test
void shouldParseLoadedFileConfiguration() {
// Given
ExtensionParam param = new ExtensionParam();
FileConfiguration config = createTestConfig(false, true, false, true, true);
// When
param.load(config);
// Then
assertThat(param.isExtensionEnabled("Extension 1"), is(equalTo(false)));
assertThat(param.isExtensionEnabled("Extension 2"), is(equalTo(true)));
assertThat(param.isExtensionEnabled("Extension 3"), is(equalTo(false)));
assertThat(param.isExtensionEnabled("Extension 4"), is(equalTo(true)));
assertThat(param.isExtensionEnabled("Extension 5"), is(equalTo(true)));
}
use of org.apache.commons.configuration.FileConfiguration in project zaproxy by zaproxy.
the class ExtensionParamUnitTest method shouldNotPersistNullExtensionNamesOrNullEnabledState.
@Test
void shouldNotPersistNullExtensionNamesOrNullEnabledState() {
// Given
ExtensionParam param = new ExtensionParam();
FileConfiguration config = createTestConfig();
param.load(config);
Map<String, Boolean> states = new HashMap<>();
states.put(null, Boolean.FALSE);
states.put("Extension 2", null);
// When
param.setExtensionsState(states);
// Then
assertThat(param.getConfig().getKeys().hasNext(), is(equalTo(false)));
}
Aggregations