Here’s the implementation of AbstractTestLog.logln():
public static final void logln(String message) {
// TODO(stuartg): turned off - causing OOM running under ant
// Probably temporary - must decide what to do with these
//System.out.println(message);
//msg(message, LOG, true, true);
}
In fact, all of the methods in this class are commented out, or don’t do any logging. The msg() method is commented out altogether, and the enums it takes as input don’t seem to exist. System.out.println() definitely seems like the wrong thing to be doing for logging, but the alternative can’t be to just do nothing.
The warn() and err() methods both just call Assert.fail(), so there’s no difference between a warning and an error, and Assert.fail() means if a test method tests more than one thing, it stops at the first failure (a problem I think all of the regular JUnit assertion methods also have).
There’s got to be some real logging framework we can tap into here for unit tests, doesn’t there? Doesn’t JUnit have something we can use? Moving to Maven seems like it gets us around the OOM problem mentioned in the comments above, but it also means all the System.out.println() calls go straight to the console, which also isn’t ideal.
Here’s the implementation of
AbstractTestLog.logln()
:public static final void logln(String message) { // TODO(stuartg): turned off - causing OOM running under ant // Probably temporary - must decide what to do with these //System.out.println(message); //msg(message, LOG, true, true); }
In fact, all of the methods in this class are commented out, or don’t do any logging. The
msg()
method is commented out altogether, and the enums it takes as input don’t seem to exist.System.out.println()
definitely seems like the wrong thing to be doing for logging, but the alternative can’t be to just do nothing.The
warn()
anderr()
methods both just callAssert.fail()
, so there’s no difference between a warning and an error, andAssert.fail()
means if a test method tests more than one thing, it stops at the first failure (a problem I think all of the regular JUnit assertion methods also have).There’s got to be some real logging framework we can tap into here for unit tests, doesn’t there? Doesn’t JUnit have something we can use? Moving to Maven seems like it gets us around the OOM problem mentioned in the comments above, but it also means all the
System.out.println()
calls go straight to the console, which also isn’t ideal.