
com.araguacaima.commons.utils.ByPassingTestingCode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-utils Show documentation
Show all versions of commons-utils Show documentation
Common utilities is a set of java utilities for managing typical actions when working with enums,
files, exceptions, zip/jar files, classes (via Reflection), maps, numbers and so on.
Most of the utilities extend functionalities offered by amazing libraries such as:
* commons-beanutils (apache)
* commons-lang3 (apache)
* commons-io (apache)
* commons-math3 (apache)
* commons-collections4 (apache)
* jreversepro (akkumar)
package com.araguacaima.commons.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.Properties;
public class ByPassingTestingCode {
private static final Logger log = LoggerFactory.getLogger(ByPassingTestingCode.class);
private final MapUtils mapUtils;
private final NotNullOrEmptyStringObjectPredicate notNullOrEmptyStringObjectPredicate;
private final PropertiesHandlerUtils propertiesHandlerUtils;
public Map BYPASSING_TESTING_CODE_PARAMETERS_MAP;
private String logFileSourceName;
public ByPassingTestingCode(PropertiesHandlerUtils propertiesHandlerUtils,
MapUtils mapUtils,
NotNullOrEmptyStringObjectPredicate notNullOrEmptyStringObjectPredicate) {
this.propertiesHandlerUtils = propertiesHandlerUtils;
this.mapUtils = mapUtils;
this.notNullOrEmptyStringObjectPredicate = notNullOrEmptyStringObjectPredicate;
}
public void init(String logFileSourceName) {
final Properties properties;
try {
properties = propertiesHandlerUtils.getHandler(logFileSourceName).getProperties();
BYPASSING_TESTING_CODE_PARAMETERS_MAP = mapUtils.select(properties,
object -> object.toString().startsWith(ByPassingTestingConstants
.BYPASSING_TESTING_CODE_PARAMETER_PREFIX),
notNullOrEmptyStringObjectPredicate);
} catch (Exception exception) {
log.debug("Config file (" + logFileSourceName + ") is null or empty. No Bypassing Testing Code", 2);
log.debug(exception.getMessage(), 2);
} finally {
if (MapUtils.isEmpty(BYPASSING_TESTING_CODE_PARAMETERS_MAP)) {
log.debug("No Bypassing Testing Code (bypassing.testing.code_) found inside the file");
} else {
log.debug("Bypassing Testing Code (bypassing.testing.code_): " + BYPASSING_TESTING_CODE_PARAMETERS_MAP);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy