Skip to content

Commit

Permalink
Fix test failures on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed Oct 8, 2024
1 parent 616b48a commit 1a621e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/test/java/org/scijava/config/log4j/Log4jTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
*/
public class Log4jTest extends AbstractLoggingTest {

private static final String NL = System.lineSeparator();

private Logger log;

@Before
Expand All @@ -54,30 +56,30 @@ public void testFatal() {
final String fatal = "Kernel panic: Fatal exception";
log.fatal(fatal);
assertEquals("", stdout());
assertEquals("[FATAL] " + fatal + "\n", stderr());
assertEquals("[FATAL] " + fatal + NL, stderr());
}

@Test
public void testError() {
final String error = "Guru Meditation";
log.error(error);
assertEquals("", stdout());
assertEquals("[ERROR] " + error + "\n", stderr());
assertEquals("[ERROR] " + error + NL, stderr());
}

@Test
public void testWarn() {
final String warning = "Watch out for snakes!";
log.warn(warning);
assertEquals("", stdout());
assertEquals("[WARN ] " + warning + "\n", stderr());
assertEquals("[WARN ] " + warning + NL, stderr());
}

@Test
public void testInfo() {
final String info = "Dogs are bigger than cats. But not all the time.";
log.info(info);
assertEquals(info + "\n", stdout());
assertEquals(info + NL, stdout());
assertEquals("", stderr());
}

Expand Down
8 changes: 5 additions & 3 deletions src/test/java/org/scijava/config/logback/LogbackTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
*/
public class LogbackTest extends AbstractLoggingTest {

private static final String NL = System.lineSeparator();

private Logger log;

@Before
Expand All @@ -56,22 +58,22 @@ public void testError() {
final String error = "Guru Meditation";
log.error(error);
assertEquals("", stdout());
assertEquals("[ERROR] " + error + "\n", stderr());
assertEquals("[ERROR] " + error + NL, stderr());
}

@Test
public void testWarn() {
final String warning = "Watch out for snakes!";
log.warn(warning);
assertEquals("", stdout());
assertEquals("[WARN] " + warning + "\n", stderr());
assertEquals("[WARN] " + warning + NL, stderr());
}

@Test
public void testInfo() {
final String info = "Dogs are bigger than cats. But not all the time.";
log.info(info);
assertEquals(info + "\n", stdout());
assertEquals(info + NL, stdout());
assertEquals("", stderr());
}

Expand Down

0 comments on commit 1a621e3

Please sign in to comment.