diff --git a/lab2/pom.xml b/lab2/pom.xml index 1fc6d21..7789715 100644 --- a/lab2/pom.xml +++ b/lab2/pom.xml @@ -9,10 +9,15 @@ http://maven.apache.org - junit - junit - 4.12 - test + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.1 diff --git a/lab2/src/test/java/ru/spbstu/telematics/java/AppTest.java b/lab2/src/test/java/ru/spbstu/telematics/java/AppTest.java index c601677..fd5e571 100644 --- a/lab2/src/test/java/ru/spbstu/telematics/java/AppTest.java +++ b/lab2/src/test/java/ru/spbstu/telematics/java/AppTest.java @@ -1,38 +1,25 @@ package ru.spbstu.telematics.java; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); +import java.util.TreeSet; + +class MyTreeSetTests { + MyTreeSet myTreeSet; + TreeSet treeSet; + + @BeforeEach + void setUp() { + myTreeSet = new MyTreeSet<>(); + treeSet = new TreeSet<>(); } - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); + @Test + void testAdd() { + assertEquals(myTreeSet.add(150), treeSet.add(150)); + assertEquals(myTreeSet.add(200), treeSet.add(200)); + assertEquals(myTreeSet.add(150), treeSet.add(150)); } }