From 17219b7eb69405c11936aee04fb607ce2e39969c Mon Sep 17 00:00:00 2001 From: Mickey Zarev Date: Tue, 3 Sep 2024 17:24:04 +0100 Subject: [PATCH] Update the logging properties to opt-out of the prefix events ESAPI#844 eigth iteration --- .../configuration/EsapiPropertyLoader.java | 7 - .../configuration/EsapiPropertyManager.java | 12 -- .../StandardEsapiPropertyLoader.java | 18 -- .../configuration/XmlEsapiPropertyLoader.java | 18 -- .../esapi/logging/java/JavaLogFactory.java | 11 +- .../esapi/logging/slf4j/Slf4JLogFactory.java | 12 +- .../DefaultSecurityConfiguration.java | 26 --- .../esapi/SecurityConfigurationWrapper.java | 5 - .../EsapiPropertyManagerTest.java | 78 ------- .../StandardEsapiPropertyLoaderTest.java | 192 ------------------ .../XmlEsapiPropertyLoaderTest.java | 183 ----------------- 11 files changed, 21 insertions(+), 541 deletions(-) diff --git a/src/main/java/org/owasp/esapi/configuration/EsapiPropertyLoader.java b/src/main/java/org/owasp/esapi/configuration/EsapiPropertyLoader.java index 2ddd16590..7709483bf 100644 --- a/src/main/java/org/owasp/esapi/configuration/EsapiPropertyLoader.java +++ b/src/main/java/org/owasp/esapi/configuration/EsapiPropertyLoader.java @@ -33,13 +33,6 @@ public interface EsapiPropertyLoader { */ public Boolean getBooleanProp(String propertyName) throws ConfigurationException; - /** - * Get any Boolean type property from security configuration. - * If property does not exist in configuration or has incorrect type, defaultValue is returned - * @return property value. - */ - public Boolean getBooleanProp(String propertyName, Boolean defaultValue); - /** * Get any property from security configuration. As every property can be returned as string, this method * throws exception only when property does not exist. diff --git a/src/main/java/org/owasp/esapi/configuration/EsapiPropertyManager.java b/src/main/java/org/owasp/esapi/configuration/EsapiPropertyManager.java index 2a7b2cecd..94b5e4d5a 100644 --- a/src/main/java/org/owasp/esapi/configuration/EsapiPropertyManager.java +++ b/src/main/java/org/owasp/esapi/configuration/EsapiPropertyManager.java @@ -76,18 +76,6 @@ public Boolean getBooleanProp(String propertyName) throws ConfigurationException throw new ConfigurationException("Could not find property " + propertyName + " in configuration"); } - /** - * {@inheritDoc} - */ - @Override - public Boolean getBooleanProp(String propertyName, Boolean defaultValue) { - for (AbstractPrioritizedPropertyLoader loader : loaders) { - return loader.getBooleanProp(propertyName, defaultValue); - } - return defaultValue; - } - - /** * {@inheritDoc} */ diff --git a/src/main/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoader.java b/src/main/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoader.java index 199355829..fe50e02d7 100644 --- a/src/main/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoader.java +++ b/src/main/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoader.java @@ -70,24 +70,6 @@ public Boolean getBooleanProp(String propertyName) throws ConfigurationException } } - /** - * {@inheritDoc} - */ - @Override - public Boolean getBooleanProp(String propertyName, Boolean defaultValue) { - String property = properties.getProperty(propertyName); - if (property == null) { - return defaultValue; - } - if (property.equalsIgnoreCase("true") || property.equalsIgnoreCase("yes")) { - return true; - } - if (property.equalsIgnoreCase("false") || property.equalsIgnoreCase("no")) { - return false; - } - return defaultValue; - } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoader.java b/src/main/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoader.java index 55e5f85c7..3b3dc8ebc 100644 --- a/src/main/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoader.java +++ b/src/main/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoader.java @@ -86,24 +86,6 @@ public Boolean getBooleanProp(String propertyName) throws ConfigurationException } } - /** - * {@inheritDoc} - */ - @Override - public Boolean getBooleanProp(String propertyName, Boolean defaultValue) { - String property = properties.getProperty(propertyName); - if (property == null) { - return defaultValue; - } - if (property.equalsIgnoreCase("true") || property.equalsIgnoreCase("yes")) { - return true; - } - if (property.equalsIgnoreCase("false") || property.equalsIgnoreCase("no")) { - return false; - } - return defaultValue; - } - /** * {@inheritDoc} */ diff --git a/src/main/java/org/owasp/esapi/logging/java/JavaLogFactory.java b/src/main/java/org/owasp/esapi/logging/java/JavaLogFactory.java index 2e246e519..918fd45b7 100644 --- a/src/main/java/org/owasp/esapi/logging/java/JavaLogFactory.java +++ b/src/main/java/org/owasp/esapi/logging/java/JavaLogFactory.java @@ -80,7 +80,16 @@ public class JavaLogFactory implements LogFactory { boolean logApplicationName = ESAPI.securityConfiguration().getBooleanProp(LOG_APPLICATION_NAME); String appName = ESAPI.securityConfiguration().getStringProp(APPLICATION_NAME); boolean logServerIp = ESAPI.securityConfiguration().getBooleanProp(LOG_SERVER_IP); - boolean logPrefix = ESAPI.securityConfiguration().getBooleanProp(LOG_PREFIX, true); + + boolean logPrefix = true; + try { + logPrefix = ESAPI.securityConfiguration().getBooleanProp(LOG_PREFIX); + } catch (ConfigurationException ex) { + System.out.println("ESAPI: Failed to read Log Prefix configuration. Defaulting to enabled" + + ". Caught " + ex.getClass().getName() + + "; exception message was: " + ex); + } + JAVA_LOG_APPENDER = createLogAppender(logUserInfo, logClientInfo, logServerIp, logApplicationName, appName, logPrefix); Map levelLookup = new HashMap<>(); diff --git a/src/main/java/org/owasp/esapi/logging/slf4j/Slf4JLogFactory.java b/src/main/java/org/owasp/esapi/logging/slf4j/Slf4JLogFactory.java index 9387dc99e..9b453960c 100644 --- a/src/main/java/org/owasp/esapi/logging/slf4j/Slf4JLogFactory.java +++ b/src/main/java/org/owasp/esapi/logging/slf4j/Slf4JLogFactory.java @@ -23,6 +23,7 @@ import org.owasp.esapi.LogFactory; import org.owasp.esapi.Logger; import org.owasp.esapi.codecs.HTMLEntityCodec; +import org.owasp.esapi.errors.ConfigurationException; import org.owasp.esapi.logging.appender.LogAppender; import org.owasp.esapi.logging.appender.LogPrefixAppender; import org.owasp.esapi.logging.cleaning.CodecLogScrubber; @@ -70,7 +71,16 @@ public class Slf4JLogFactory implements LogFactory { boolean logApplicationName = ESAPI.securityConfiguration().getBooleanProp(LOG_APPLICATION_NAME); String appName = ESAPI.securityConfiguration().getStringProp(APPLICATION_NAME); boolean logServerIp = ESAPI.securityConfiguration().getBooleanProp(LOG_SERVER_IP); - boolean logPrefix = ESAPI.securityConfiguration().getBooleanProp(LOG_PREFIX, true); + + boolean logPrefix = true; + try { + logPrefix = ESAPI.securityConfiguration().getBooleanProp(LOG_PREFIX); + } catch (ConfigurationException ex) { + System.out.println("ESAPI: Failed to read Log Prefix configuration. Defaulting to enabled" + + ". Caught " + ex.getClass().getName() + + "; exception message was: " + ex); + } + SLF4J_LOG_APPENDER = createLogAppender(logUserInfo, logClientInfo, logServerIp, logApplicationName, appName, logPrefix); Map levelLookup = new HashMap<>(); diff --git a/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java b/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java index 400be5457..eb561349b 100644 --- a/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java +++ b/src/main/java/org/owasp/esapi/reference/DefaultSecurityConfiguration.java @@ -1456,32 +1456,6 @@ public Boolean getBooleanProp(String propertyName) throws ConfigurationException } } - /** - * {@inheritDoc} - * Looks for property in three configuration files in following order: - * 1.) In file defined as org.owasp.esapi.opsteam system property - * 2.) In file defined as org.owasp.esapi.devteam system property - * 3.) In ESAPI.properties - */ - @Override - public Boolean getBooleanProp(String propertyName, Boolean defaultValue) { - try { - return esapiPropertyManager.getBooleanProp(propertyName); - } catch (ConfigurationException ex) { - String property = properties.getProperty(propertyName); - if ( property == null ) { - return defaultValue; - } - if ( property.equalsIgnoreCase("true") || property.equalsIgnoreCase("yes") ) { - return true; - } - if ( property.equalsIgnoreCase("false") || property.equalsIgnoreCase("no") ) { - return false; - } - return defaultValue; - } - } - /** * {@inheritDoc} * Looks for property in three configuration files in following order: diff --git a/src/test/java/org/owasp/esapi/SecurityConfigurationWrapper.java b/src/test/java/org/owasp/esapi/SecurityConfigurationWrapper.java index 3d8bf123a..1d5a521b8 100644 --- a/src/test/java/org/owasp/esapi/SecurityConfigurationWrapper.java +++ b/src/test/java/org/owasp/esapi/SecurityConfigurationWrapper.java @@ -558,11 +558,6 @@ public Boolean getBooleanProp(String propertyName) throws ConfigurationException return wrapped.getBooleanProp(propertyName); } - @Override - public Boolean getBooleanProp(String propertyName, Boolean defaultValue) { - return wrapped.getBooleanProp(propertyName, defaultValue); - } - @Override public String getStringProp(String propertyName) throws ConfigurationException { return wrapped.getStringProp(propertyName); diff --git a/src/test/java/org/owasp/esapi/configuration/EsapiPropertyManagerTest.java b/src/test/java/org/owasp/esapi/configuration/EsapiPropertyManagerTest.java index dcf98c40c..507f33ce1 100644 --- a/src/test/java/org/owasp/esapi/configuration/EsapiPropertyManagerTest.java +++ b/src/test/java/org/owasp/esapi/configuration/EsapiPropertyManagerTest.java @@ -288,46 +288,6 @@ public void testBooleanPropFoundInLoader() { assertEquals(expectedPropertyValue, propertyValue); } - - @Test - public void testBooleanPropFoundInLoaderWithDefaultValueTrue() { - // given - System.setProperty(EsapiConfiguration.DEVTEAM_ESAPI_CFG.getConfigName(), xmlFilename1); - String propertyKey = "boolean_property"; - boolean expectedPropertyValue = true; - - // when - try { - testPropertyManager = new EsapiPropertyManager(); - } catch (IOException e) { - fail(e.getMessage()); - } - boolean propertyValue = testPropertyManager.getBooleanProp(propertyKey, true); - - // then - assertEquals(expectedPropertyValue, propertyValue); - } - - @Test - public void testBooleanPropFoundInLoaderWithDefaultValueFalse() { - // given - System.setProperty(EsapiConfiguration.DEVTEAM_ESAPI_CFG.getConfigName(), xmlFilename1); - String propertyKey = "boolean_property"; - boolean expectedPropertyValue = true; - - // when - try { - testPropertyManager = new EsapiPropertyManager(); - } catch (IOException e) { - fail(e.getMessage()); - } - boolean propertyValue = testPropertyManager.getBooleanProp(propertyKey, false); - - // then - assertEquals(expectedPropertyValue, propertyValue); - } - - @Test(expected = ConfigurationException.class) public void testBooleanPropertyNotFoundByLoaderAndThrowException() { // given @@ -344,44 +304,6 @@ public void testBooleanPropertyNotFoundByLoaderAndThrowException() { // then expect exception } - @Test - public void testBooleanPropertyNotFoundByLoaderWithDefaultValueTrue() { - // given - String propertyKey = "non.existing.property"; - boolean expectedPropertyValue = true; - - // when - try { - testPropertyManager = new EsapiPropertyManager(); - } catch (IOException e) { - fail(e.getMessage()); - } - - boolean propertyValue = testPropertyManager.getBooleanProp(propertyKey, true); - - // then - assertEquals(expectedPropertyValue, propertyValue); - } - - @Test - public void testBooleanPropertyNotFoundByLoaderWithDefaultValueFalse() { - // given - String propertyKey = "non.existing.property"; - boolean expectedPropertyValue = false; - - // when - try { - testPropertyManager = new EsapiPropertyManager(); - } catch (IOException e) { - fail(e.getMessage()); - } - - boolean propertyValue = testPropertyManager.getBooleanProp(propertyKey, false); - - // then - assertEquals(expectedPropertyValue, propertyValue); - } - @Test public void testByteArrayPropFoundInLoader() { // given diff --git a/src/test/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoaderTest.java b/src/test/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoaderTest.java index 77fe1643b..080644642 100644 --- a/src/test/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoaderTest.java +++ b/src/test/java/org/owasp/esapi/configuration/StandardEsapiPropertyLoaderTest.java @@ -239,48 +239,6 @@ public void testGetBooleanProp() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanPropWithDefaultValueTrue() { - // given - String filename = "src" + File.separator + "test" + File.separator + "resources" + File.separator + - "esapi" + File.separator + "ESAPI-test.properties"; - int priority = 1; - String propertyKey = "boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(propertyKey,true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanPropWithDefaultValueFalse() { - // given - String filename = "src" + File.separator + "test" + File.separator + "resources" + File.separator + - "esapi" + File.separator + "ESAPI-test.properties"; - int priority = 1; - String propertyKey = "boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(propertyKey,false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetBooleanYesProperty() { // given @@ -299,42 +257,6 @@ public void testGetBooleanYesProperty() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanYesPropertyWithDefaultValueTrue() { - // given - String key = "boolean_yes_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key,true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanYesPropertyWithDefaultValueFalse() { - // given - String key = "boolean_yes_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key,false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetBooleanNoProperty() { // given @@ -353,42 +275,6 @@ public void testGetBooleanNoProperty() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanNoPropertyWithDefaultValueTrue() { - // given - String key = "boolean_no_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanNoPropertyWithDefaultValueFalse() { - // given - String key = "boolean_no_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test(expected = ConfigurationException.class) public void testBooleanPropertyNotFound() throws ConfigurationException { // given @@ -408,48 +294,6 @@ public void testBooleanPropertyNotFound() throws ConfigurationException { // then expect exception } - @Test - public void testBooleanPropertyNotFoundWithDefaultValueTrue() { - // given - String filename = "src" + File.separator + "test" + File.separator + "resources" + File.separator + - "esapi" + File.separator + "ESAPI-test.properties"; - int priority = 1; - String propertyKey = "non-existing-key"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(propertyKey, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testBooleanPropertyNotFoundWithDefaultValueFalse() { - // given - String filename = "src" + File.separator + "test" + File.separator + "resources" + File.separator + - "esapi" + File.separator + "ESAPI-test.properties"; - int priority = 1; - String propertyKey = "non-existing-key"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(propertyKey, false); - - // then - assertEquals(expectedValue, value); - } - @Test(expected = ConfigurationException.class) public void testIncorrectBooleanPropertyType() throws ConfigurationException { // given @@ -466,42 +310,6 @@ public void testIncorrectBooleanPropertyType() throws ConfigurationException { // then expect exception } - @Test - public void testIncorrectBooleanPropertyTypeWithDefaultValueTrue() { - // given - String key = "invalid_boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testIncorrectBooleanPropertyTypeWithDefaultValueFalse() { - // given - String key = "invalid_boolean_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new StandardEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetByteArrayProp() { // given diff --git a/src/test/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoaderTest.java b/src/test/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoaderTest.java index f52be60e9..6aecec533 100644 --- a/src/test/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoaderTest.java +++ b/src/test/java/org/owasp/esapi/configuration/XmlEsapiPropertyLoaderTest.java @@ -254,42 +254,6 @@ public void testGetBooleanProp() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanPropWithDefaultValueTrue() { - // given - String key = "boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanPropWithDefaultValueFalse() { - // given - String key = "boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetBooleanYesProperty() { // given @@ -308,42 +272,6 @@ public void testGetBooleanYesProperty() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanYesPropertyWithDefaultValueTrue() { - // given - String key = "boolean_yes_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanYesPropertyWithDefaultValueFalse() { - // given - String key = "boolean_yes_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetBooleanNoProperty() { // given @@ -362,42 +290,6 @@ public void testGetBooleanNoProperty() { assertEquals(expectedValue, value); } - @Test - public void testGetBooleanNoPropertyWithDefaultValueTrue() { - // given - String key = "boolean_no_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testGetBooleanNoPropertyWithDefaultValueFalse() { - // given - String key = "boolean_no_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test(expected = ConfigurationException.class) public void testBooleanPropertyNotFound() throws ConfigurationException { // given @@ -414,45 +306,6 @@ public void testBooleanPropertyNotFound() throws ConfigurationException { // then expect exception } - @Test - public void testBooleanPropertyNotFoundWithDefaultValueTrue() { - // given - String key = "non-existing-key"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - - - // then expect exception - } - - @Test - public void testBooleanPropertyNotFoundWithDefaultValueFalse() { - // given - String key = "non-existing-key"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test(expected = ConfigurationException.class) public void testIncorrectBooleanPropertyType() throws ConfigurationException { // given @@ -469,42 +322,6 @@ public void testIncorrectBooleanPropertyType() throws ConfigurationException { // then expect exception } - @Test - public void testIncorrectBooleanPropertyTypeWithDefaultValueTrue() { - // given - String key = "invalid_boolean_property"; - boolean expectedValue = true; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, true); - - // then - assertEquals(expectedValue, value); - } - - @Test - public void testIncorrectBooleanPropertyTypeWithDefaultValueFalse() { - // given - String key = "invalid_boolean_property"; - boolean expectedValue = false; - - // when - try { - testPropertyLoader = new XmlEsapiPropertyLoader(filename, priority); - } catch ( IOException e ) { - fail( e.getMessage() ); - } - boolean value = testPropertyLoader.getBooleanProp(key, false); - - // then - assertEquals(expectedValue, value); - } - @Test public void testGetByteArrayProp() { // given