mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Moved unittests to JUnit 5
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -27,12 +27,6 @@
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
|
||||
@@ -7,10 +7,9 @@ import org.toop.eventbus.GlobalEventBus;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestGlobalEventBus {
|
||||
public class GlobalEventBusTest {
|
||||
|
||||
// Sample event class
|
||||
public static class TestEvent {
|
||||
@@ -1,50 +1,51 @@
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.toop.server.Server;
|
||||
import org.toop.server.backend.*;
|
||||
|
||||
public class TestServerTest {
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class ServerTest {
|
||||
|
||||
private Server server;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
server = new Server(Server.ServerBackend.LOCAL, "127.0.0.1", "8080");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructorSetsValues() {
|
||||
Assert.assertEquals("127.0.0.1", server.getIp());
|
||||
Assert.assertEquals("8080", server.getPort());
|
||||
assertEquals("127.0.0.1", server.getIp());
|
||||
assertEquals("8080", server.getPort());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetIpUpdatesValue() {
|
||||
server.setIp("192.168.1.1");
|
||||
Assert.assertEquals("192.168.1.1", server.getIp());
|
||||
assertEquals("192.168.1.1", server.getIp());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPortUpdatesValue() {
|
||||
server.setPort("9090");
|
||||
Assert.assertEquals("9090", server.getPort());
|
||||
assertEquals("9090", server.getPort());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetLocalBackend() {
|
||||
Assert.assertEquals(new Local(), server.getBackend());
|
||||
assertEquals(new Local(), server.getBackend());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetRemoteBackend() {
|
||||
server.setBackend(Server.ServerBackend.REMOTE);
|
||||
Assert.assertEquals(new Remote(), server.getBackend());
|
||||
assertEquals(new Remote(), server.getBackend());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotNullAfterConstruction() {
|
||||
Assert.assertNotNull(server);
|
||||
assertNotNull(server);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user