Skip to content
Snippets Groups Projects
Commit 76e7537c authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Added assert to check for lack of log4j.xml in jar. Enabled assertions and forking for unit tests

parent f0d69f21
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,16 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>pertest</forkMode>
<argLine>-enableassertions</argLine>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
......
......@@ -21,6 +21,8 @@ package com.syncleus.dann.examples;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.URL;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
......@@ -45,7 +47,11 @@ public final class Main
if(new File("log4j.xml").exists())
DOMConfigurator.configure("log4j.xml");
else
DOMConfigurator.configure(ClassLoader.getSystemResource("log4j.xml"));
{
final URL logConfig = ClassLoader.getSystemResource("log4j.xml");
assert logConfig != null;
DOMConfigurator.configure(logConfig);
}
LOGGER.info("program started...");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment