From 65f7586e2479331ddfa9977449114e5e039307e9 Mon Sep 17 00:00:00 2001 From: Arity-T Date: Mon, 3 Feb 2025 17:37:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D0=BB=20ju?= =?UTF-8?q?nit=20=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=20=D0=BD=D0=B0=20=D0=B4=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=8D=D0=BB=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab2/pom.xml | 13 +++-- .../ru/spbstu/telematics/java/AppTest.java | 49 +++++++------------ 2 files changed, 27 insertions(+), 35 deletions(-) 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)); } }