io.github.davidebocca.util.unit.test.UnitTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unit-test Show documentation
Show all versions of unit-test Show documentation
Simple library to help developments of util tests
/**
*
*/
package io.github.davidebocca.util.unit.test;
import java.text.MessageFormat;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import io.github.davidebocca.util.unit.test.exception.UnitTestException;
import io.github.davidebocca.util.unit.test.rules.utils.AbstractRule;
/**
* @author cr10248
*
*/
public class UnitTest {
/**
*
*/
private static final Logger LOGGER = LogManager.getLogger(UnitTest.class.getName());
/**
*
*/
private List rules;
/**
*
*/
boolean pojoTest = false;
/**
*
* @param rules
*/
public UnitTest(List rules) {
LOGGER.debug(" ");
LOGGER.debug("*****************");
LOGGER.debug(" UNIT TEST ");
LOGGER.debug("*****************");
LOGGER.debug(" ");
this.rules = rules;
}
/**
*
* @throws UnitTestException
*/
public void executeTests() throws UnitTestException {
int j = 1;
for (int i = 0; i < rules.size(); i++) {
AbstractRule rule = rules.get(i);
LOGGER.debug(MessageFormat.format("Executing rule {0} ({1} of {2})",
rule.getRuleId().name(), j++, rules.size()));
rule.executeTest();
}
}
}