Refactor tests and silence log4j output.