Обновил junit и добавил тест на добавление элементов

This commit is contained in:
2025-02-03 17:37:34 +03:00
parent a87c13dc42
commit 65f7586e24
2 changed files with 27 additions and 35 deletions

View File

@@ -9,10 +9,15 @@
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>4.12</version> <version>5.9.1</version>
<scope>test</scope> <scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -1,38 +1,25 @@
package ru.spbstu.telematics.java; package ru.spbstu.telematics.java;
import junit.framework.Test; import org.junit.jupiter.api.BeforeEach;
import junit.framework.TestCase; import org.junit.jupiter.api.Test;
import junit.framework.TestSuite; import static org.junit.jupiter.api.Assertions.*;
/** import java.util.TreeSet;
* Unit test for simple App.
*/ class MyTreeSetTests {
public class AppTest MyTreeSet<Integer> myTreeSet;
extends TestCase TreeSet<Integer> treeSet;
{
/** @BeforeEach
* Create the test case void setUp() {
* myTreeSet = new MyTreeSet<>();
* @param testName name of the test case treeSet = new TreeSet<>();
*/
public AppTest( String testName )
{
super( testName );
} }
/** @Test
* @return the suite of tests being tested void testAdd() {
*/ assertEquals(myTreeSet.add(150), treeSet.add(150));
public static Test suite() assertEquals(myTreeSet.add(200), treeSet.add(200));
{ assertEquals(myTreeSet.add(150), treeSet.add(150));
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
} }
} }