From bba1010e6540f1aaada2f8b2f91fb0943c56c818 Mon Sep 17 00:00:00 2001 From: Philipp3107 Date: Tue, 10 Jan 2023 01:24:59 +0100 Subject: [PATCH] added factory test --- tests/tests/FactoryTest.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/tests/FactoryTest.java b/tests/tests/FactoryTest.java index 115dfa5..fda00c3 100644 --- a/tests/tests/FactoryTest.java +++ b/tests/tests/FactoryTest.java @@ -1,10 +1,11 @@ package tests; +import domain.Robot; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import src.domain.C3PO; -import src.domain.Factory; -import src.domain.RobotType; +import domain.C3PO; +import domain.Factory; +import domain.RobotType; import static org.junit.jupiter.api.Assertions.*; @@ -14,26 +15,27 @@ class FactoryTest { @BeforeEach void setup(){ f = new Factory(); - } - @Test - void robotListToCollection() { - + f.buildNewRobot("herbi", RobotType.C3PO); + f.buildNewRobot("Herta", RobotType.R2D2); } @Test void getRobotList() { - + assertEquals(2, f.getRobotList().length); + f.buildNewRobot("Herbi3", RobotType.C3PO); + assertEquals(3, f.getRobotList().length); } @Test void buildNewRobot() { - asserEquals(true, f.buildNewRobot("herbi", RobotType.R2D2)); + boolean test = f.buildNewRobot("herbi", RobotType.R2D2); + assertEquals(true, test); } @Test void getRobotOfList() { - String[] test = new String[0]; - assertEquals(test, f.getRobotList()); + Robot r = f.getRobotOfList(0); + assertEquals( "herbi",r.getName()); } } \ No newline at end of file