Skip to content

Commit

Permalink
Lower unit test logging verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Mar 2, 2024
1 parent 89dce7f commit dc9f1ad
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/test/java/net/ucanaccess/test/AbstractBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.ucanaccess.exception.UcanaccessRuntimeException;
import net.ucanaccess.util.Try;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
Expand All @@ -29,7 +28,7 @@
*/
public abstract class AbstractBaseTest extends Assertions {

/** The jpl logger. */
/** The java platform/system logger. */
private Logger logger;

/** Holds information about the current test. */
Expand Down Expand Up @@ -61,20 +60,11 @@ protected final String getShortTestMethodName() {

@BeforeEach
public final void logTestBegin(TestInfo _testInfo) {
logTestBeginEnd("BGN", _testInfo);
}

@AfterEach
public final void logTestEnd(TestInfo _testInfo) {
logTestBeginEnd("END", _testInfo);
}

protected void logTestBeginEnd(CharSequence _prefix, TestInfo _testInfo) {
if (_testInfo.getTestMethod().isEmpty() || _testInfo.getDisplayName().startsWith(_testInfo.getTestMethod().get().getName())) {
getLogger().log(Level.INFO, ">>>>>>>>>> {0} Test: {1} <<<<<<<<<<", _prefix, _testInfo.getDisplayName());
getLogger().log(Level.INFO, ">>>>>>>>>> TEST: {0} <<<<<<<<<<", _testInfo.getDisplayName());
} else {
getLogger().log(Level.INFO, ">>>>>>>>>> {0} Test: {1} ({2}) <<<<<<<<<<",
_prefix, _testInfo.getTestMethod().get().getName(), _testInfo.getDisplayName());
getLogger().log(Level.INFO, ">>>>>>>>>> TEST: {0} ({1}) <<<<<<<<<<",
_testInfo.getTestMethod().get().getName(), _testInfo.getDisplayName());
}
}

Expand Down

0 comments on commit dc9f1ad

Please sign in to comment.