Browse Source

test_ Konstruktortest

remotes/origin/server
Paul Kattenborn 11 months ago
parent
commit
5cf6e48004
  1. 57
      pom.xml
  2. 26
      src/test/java/ChatServerTest.java

57
pom.xml

@ -1,24 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.progmethoden</groupId>
<artifactId>java-chat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.1.10</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties>
<junit-jupiter-version>RELEASE</junit-jupiter-version>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>org.progmethoden</groupId>
<artifactId>java-chat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

26
src/test/java/ChatServerTest.java

@ -0,0 +1,26 @@
import static org.junit.jupiter.api.Assertions.*;
import java.util.List;
import org.junit.jupiter.api.Test;
class ChatServerTest {
@Test
public void testConstructor() {
// Arrange
ChatServer chatServer = null;
// Act
try {
chatServer = new ChatServer(1234);
} catch (Exception e) {
fail("Exception occurred: " + e.getMessage());
}
// Assert
assertNotNull(chatServer);
}
}
Loading…
Cancel
Save