Reformatted tests

This commit is contained in:
lieght
2025-09-20 23:04:40 +02:00
parent cc7048da68
commit 0926df1945
5 changed files with 55 additions and 51 deletions

View File

@@ -53,7 +53,8 @@ public class LoggingTest {
void testDisableLogsForClass_addsLoggerWithOff() { void testDisableLogsForClass_addsLoggerWithOff() {
Logging.disableLogsForClass(LoggingTest.class); Logging.disableLogsForClass(LoggingTest.class);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName()); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName());
assertNotNull(loggerConfig); assertNotNull(loggerConfig);
assertEquals(Level.OFF, loggerConfig.getLevel()); assertEquals(Level.OFF, loggerConfig.getLevel());
} }
@@ -62,7 +63,8 @@ public class LoggingTest {
void testEnableLogsForClass_addsLoggerWithLevel() { void testEnableLogsForClass_addsLoggerWithLevel() {
Logging.enableLogsForClass(LoggingTest.class, Level.ERROR); Logging.enableLogsForClass(LoggingTest.class, Level.ERROR);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName()); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName());
assertNotNull(loggerConfig); assertNotNull(loggerConfig);
assertEquals(Level.ERROR, loggerConfig.getLevel()); assertEquals(Level.ERROR, loggerConfig.getLevel());
} }
@@ -71,7 +73,8 @@ public class LoggingTest {
void testEnableLogsForClass_withStringLevel() { void testEnableLogsForClass_withStringLevel() {
Logging.enableLogsForClass(LoggingTest.class.getName(), "INFO"); Logging.enableLogsForClass(LoggingTest.class.getName(), "INFO");
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName()); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName());
assertNotNull(loggerConfig); assertNotNull(loggerConfig);
assertEquals(Level.INFO, loggerConfig.getLevel()); assertEquals(Level.INFO, loggerConfig.getLevel());
} }
@@ -80,7 +83,8 @@ public class LoggingTest {
void testEnableDebugLogsForClass_setsDebug() { void testEnableDebugLogsForClass_setsDebug() {
Logging.enableDebugLogsForClass(LoggingTest.class); Logging.enableDebugLogsForClass(LoggingTest.class);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName()); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName());
assertNotNull(loggerConfig); assertNotNull(loggerConfig);
assertEquals(Level.DEBUG, loggerConfig.getLevel()); assertEquals(Level.DEBUG, loggerConfig.getLevel());
} }
@@ -89,7 +93,8 @@ public class LoggingTest {
void testEnableInfoLogsForClass_setsInfo() { void testEnableInfoLogsForClass_setsInfo() {
Logging.enableInfoLogsForClass(LoggingTest.class); Logging.enableInfoLogsForClass(LoggingTest.class);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName()); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get(LoggingTest.class.getName());
assertNotNull(loggerConfig); assertNotNull(loggerConfig);
assertEquals(Level.INFO, loggerConfig.getLevel()); assertEquals(Level.INFO, loggerConfig.getLevel());
} }
@@ -98,7 +103,8 @@ public class LoggingTest {
void testDisableLogsForNonexistentClass_doesNothing() { void testDisableLogsForNonexistentClass_doesNothing() {
Logging.disableLogsForClass("org.toop.DoesNotExist"); Logging.disableLogsForClass("org.toop.DoesNotExist");
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggers().get("org.toop.DoesNotExist"); LoggerConfig loggerConfig =
ctx.getConfiguration().getLoggers().get("org.toop.DoesNotExist");
assertNull(loggerConfig); // class doesn't exist, so no logger added assertNull(loggerConfig); // class doesn't exist, so no logger added
} }
} }

View File

@@ -1,13 +1,11 @@
package org.toop.backend; package org.toop.backend;
import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*;
import org.toop.backend.tictactoe.ParsedCommand;
import java.io.*; import java.io.*;
import java.net.Socket; import java.net.Socket;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;
class TcpServerTest { class TcpServerTest {
@@ -39,7 +37,8 @@ class TcpServerTest {
server.stop(); server.stop();
try { try {
serverThread.join(1000); serverThread.join(1000);
} catch (InterruptedException ignored) {} } catch (InterruptedException ignored) {
}
} }
@Test @Test

View File

@@ -3,9 +3,8 @@ package org.toop.eventbus;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import org.junit.jupiter.api.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.*;
class GlobalEventBusTest { class GlobalEventBusTest {