From 2b3ac712d85d5a6388b83a88dabdbaac8c4386aa Mon Sep 17 00:00:00 2001 From: Philipp3107 Date: Tue, 10 Jan 2023 01:05:36 +0100 Subject: [PATCH 1/2] my changes --- .../Robot_Factory_PR/classpath.index | Bin 0 -> 320 bytes .../robot_exceptions/robotExceptions.class | Bin 1510 -> 1536 bytes .../tests/tests/C3POTest.class | Bin 4920 -> 4972 bytes .../tests/tests/FactoryTest.class | Bin 0 -> 1116 bytes .../tests/tests/R2D2Test.class | Bin 3481 -> 3507 bytes src/domain/Factory.java | 1 - tests/tests/FactoryTest.java | 13 +++++++++++++ 7 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 out/production/Robot_Factory_PR/classpath.index create mode 100644 out/production/Robot_Factory_PR/tests/tests/FactoryTest.class diff --git a/out/production/Robot_Factory_PR/classpath.index b/out/production/Robot_Factory_PR/classpath.index new file mode 100644 index 0000000000000000000000000000000000000000..699ea3706c0e37b195f7874e911c462d93c1ed06 GIT binary patch literal 320 zcmb1O;9y{2U9lFM&4iZ}%Mdr)BW=+x*0P z^SM2>#F&=s*DaNqu>WUh=9Xs`a{E_3@Vo8E9SJsoQvza6-4_tekpbZ`FkDt(UmQuH{`cDpLI+Q`jzza6kP-L(>LZ7Op(ylb5V!86xo#Z^+U(aF#n-;cg z+{HbH9Tj$*ZcJ5>?Mp2}hxetkA4MY6QUwuV`CxJQF6KThcgs`Ip%C?1Po=?-I#4aa zu;R)<9LK$;2+w)bCr{p09`_qOlx970ru3yG{FZx*G_8z ze$pOFo-(;J6mHO+A$z9c&=W_}NRXRq`U}$}?9hZHXz&=lG$Uje=%vXc&o=!z^fj?` z^$P40{UmUotO)}dJRoZiH{c<`%=3t%iNWEQNDg9l^#`nrD`dVPJ7JhXH!v2FiH4GZpabmYZHs?Z~&4+Byh3sBK-jE1JhSlUx y;UmqSCm6@g diff --git a/tests/tests/FactoryTest.java b/tests/tests/FactoryTest.java index c0f99d7..d89a58d 100644 --- a/tests/tests/FactoryTest.java +++ b/tests/tests/FactoryTest.java @@ -1,11 +1,20 @@ package tests.tests; +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 static org.junit.jupiter.api.Assertions.*; class FactoryTest { + Factory f; + @BeforeEach + void setup(){ + f = new Factory(); + } @Test void robotListToCollection() { @@ -18,9 +27,13 @@ class FactoryTest { @Test void buildNewRobot() { + asserEquals(true, f.buildNewRobot("herbi", RobotType.R2D2)); + } @Test void getRobotOfList() { + String[] test = new String[0]; + assertEquals(test, f.getRobotList()); } } \ No newline at end of file From bba1010e6540f1aaada2f8b2f91fb0943c56c818 Mon Sep 17 00:00:00 2001 From: Philipp3107 Date: Tue, 10 Jan 2023 01:24:59 +0100 Subject: [PATCH 2/2] 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