From 006bf809587f003e7e658c39b2fa144c1ea147b1 Mon Sep 17 00:00:00 2001 From: hertero Date: Tue, 30 Aug 2022 16:36:26 +0200 Subject: [PATCH] =?UTF-8?q?Schreiben=20weiterer=20Testf=C3=A4lle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/solution/SimpleListTest90.java | 68 ++++++++++++++++++- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/SimpleLinkedList/src/solution/SimpleListTest90.java b/SimpleLinkedList/src/solution/SimpleListTest90.java index 2c0f6c6..9580b62 100644 --- a/SimpleLinkedList/src/solution/SimpleListTest90.java +++ b/SimpleLinkedList/src/solution/SimpleListTest90.java @@ -1,7 +1,6 @@ package solution; import static org.junit.jupiter.api.Assertions.assertEquals; - import org.junit.Test; import org.junit.jupiter.api.BeforeEach; @@ -9,6 +8,12 @@ public abstract class SimpleListTest90 { //ISimpleList list; ISimpleList> nodeList; + protected Node nodeNull = new Node(null); + protected Node node0 = new Node(0); + protected Node node1 = new Node(1); + protected Node node2 = new Node(2); + protected Node node3 = new Node(3); + protected Node node4 = new Node(4); protected ISimpleList getInstance1() { // TODO Auto-generated method stub @@ -26,9 +31,66 @@ public abstract class SimpleListTest90 { } @Test - void testAdd(Node node) { - boolean actual = nodeList.add(node); + void testAdd() { + + boolean actual = nodeList.add(node1); + assertEquals(true, actual); + } + + @Test + void testRemoveObject() { + nodeList.add(node1); + nodeList.add(node2); + nodeList.add(node3); + + boolean actual = nodeList.remove(node2); + assertEquals(true, actual); + } + + @Test + void testContainsTrue() { + nodeList.add(node1); + nodeList.add(node2); + + boolean actual = nodeList.contains(node1); + assertEquals(true, actual); + } + + @Test + void testContainsFalse() { + nodeList.add(node1); + nodeList.add(node2); + + boolean actual = nodeList.contains(node3); + assertEquals(false, actual); + } + + @Test + void getNodeIndex() { + nodeList.add(node1); + nodeList.add(node2); + Node actual = nodeList.get(1); + assertEquals(node2, actual); + } + + @Test + void setNodeIndex() { + //TODO + } + + @Test + void testRemoveIndex() { + nodeList.add(node1); + nodeList.add(node2); + nodeList.add(node3); + + boolean actual = nodeList.remove(1); assertEquals(true, actual); } + + @Test + void testAddIndex() { + //TODO + } }