From adca32b401a10b6d48e6899baad43d6c9ecc48ed Mon Sep 17 00:00:00 2001 From: Eline Date: Mon, 9 Jan 2023 12:42:29 +0100 Subject: [PATCH 1/5] branch commit --- bin/C3PO.class | Bin 2683 -> 0 bytes bin/Nexus6.class | Bin 2862 -> 0 bytes bin/R2D2.class | Bin 2683 -> 0 bytes bin/tpe/exceptions/roboter/Robot.class | Bin 205 -> 0 bytes bin/tpe/exceptions/roboter/RobotControl.class | Bin 334 -> 0 bytes .../exceptions/roboter/RobotInstructions.class | Bin 291 -> 0 bytes .../roboter/exceptions/RobotException.class | Bin 338 -> 0 bytes .../exceptions/RobotIllegalStateException.class | Bin 371 -> 0 bytes .../exceptions/RobotMagicValueException.class | Bin 365 -> 0 bytes 9 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 bin/C3PO.class delete mode 100644 bin/Nexus6.class delete mode 100644 bin/R2D2.class delete mode 100644 bin/tpe/exceptions/roboter/Robot.class delete mode 100644 bin/tpe/exceptions/roboter/RobotControl.class delete mode 100644 bin/tpe/exceptions/roboter/RobotInstructions.class delete mode 100644 bin/tpe/exceptions/roboter/exceptions/RobotException.class delete mode 100644 bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class delete mode 100644 bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class diff --git a/bin/C3PO.class b/bin/C3PO.class deleted file mode 100644 index cfa7783ee8cb82853b1301c4206a1c4030b11449..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2683 zcmb7GTUQfT6#h;w1j1ONHChowL=h88Y*n<4pn_6q16Z-NN-v%yhcJ-L#K{Du&;E+` z$tPa=(5_{z`rztw+rQBF{)IkR`<=-U21sqYvNGqk_qV@&IeX@pzn;GUFov}lLIRP= zGdJd9hzKNB8*!VeB=q2X6>; z)+>4C+>-gS2WuB(c|kg+Ui+I7ciF5FEvH?enP^G5)1*Vx=?(}SG7v+%K#cpd z9=rWRr*`wxqP+$>5GQ?7E|rwy(Vf3*cX#>M}o7NaV zi`Lq-wZ&BUT?BnfYonJ99fl12CYPGyB(6>!~scsc?U1z5J2{~ND2Qf?u9NfjB0c+qo z7=ds_Rs}8$H44hJz8lR?Vhe8V_=uMw8^;WI{buRNE_0K1xy);5JB;KFe9S^#v3YT< zlEA2M*1N5f%hH)w_v*?jsB8<1O&rg;c>}lb3Bd{tcotF62R|uWI>9<@^o48;pKhkx zBfz+LtlE`RQh7^XO2I-ACZn{f7<941(w(>KPC-qX`aXB)D?6e+CeVa!yEH4SGs<1I zi?ui;3Nhpbj(IWhY?#)Xy{a-fS;-eA1?7^|p;?2Rga(Ui#Rko`QcLfH6F8O%~YWZ6U zl;T*xih)&>ndCKDuB*AFf7fs1P#a^`P6mzfek!)a&B_X7JevU1Y)o60awf~NR#WUs zj=+gsX=@ey82J7;@_JF--MvhqpWP|Uf0WOV?(4kUA>FjSk=>c2Zqnszev7=7QMGZpy}eH&;`g*j?B!q9FUU?hNUM&dBt=ppG|y3rQ^Px@~4Q!au~ zSA?*gIM#w=-%bYy0x;2LbOvzTS03i5Iflee?}h@Jp{C{u4AQHU9ua{dFT%6j33JCt zrJo=*lNx@4ku9`1Pk|9;>$Hb>v?1#w>dd`^cgdlRzcZYL_~V<)=U4Z!2hvY*_8Hz6 zc#g}!Gh7W}--l0;dxo1K{EUT};VqNhgaXboR_9nrqcnRSN4f6jYfKkQgTg?Q!hlbq zpT<689qP34y~=UBqrVeTBTuAXj77#bFq-Zi8IANtilfmDB+|)f;!hw%juLiiG2anv_ziF?baz($oj`m^F5YN+GT->^JRwg3PC diff --git a/bin/Nexus6.class b/bin/Nexus6.class deleted file mode 100644 index d56ae451292eb691212be87f54e78315ea9e24e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2862 zcma)8TUQfT6#h;wBqW1SG~N{vMM#iPYtc4J6$GV*i=wtlZJmSz41}3DnIPEq&0os}2p#N*h{2xZ%-sI>zcnvqbmgBp_1xaBMw6@lb}bjE9J6Ft3k zzAZD3UR<8g%YNXfGNl?MPd#FMnsg=EMyCd%v{Rjh1!=p=%-k`Y;-c$IecI@o*DKEG zhU@~z3Gy$M2o%RHO3jO!Mk{5hFH^3b+3^M}l(@$|TelRaLg-RPUq z{0cPS7RP0_MqdI~a4m+bOk`8I5vx>UQ(88a{0JZOge_TY2XldS^255lJF=+TGxBy- zvcGZ-BGz!+LQ^U z-=Ip%lA?JRzM$Yp#;OB9>yH|3Oz3H;Q4d zTFWw<*H;R2It}%CU5T@tz`<|Nom_$T#~2W%iLr^ipZYaAdBv39NZ{FeSedK`(!)4Q2v2aa)5879zH)m#T7V z{=fabDym>S*GGcE*rAg5*2dWi)I8UQs(?0bn$jLA>6MDC#K3|d-c+_m;>Ym0!2UOz z^8WBDg-+g2Vg5%EK}cQb?Cy}d#NClsILCx~M{rDXw-s%)ev3~T+Nr`Axpdx(y7_#ry$7~4q-3>6`P z1cSGcObYETrsg4_%O%!~LpbcCkNUK>eUH>HXsMIq^S8tcyZp9rBm?r?LEN1+p53m6 zP*jhg$A`>vRD`4HAF<~fPJ%h^5Accld<1%tZs6RZ2n3zG8aiicQeF3@N-=WhS4gHK zROkWXHKn|4Jf(VAzFumSrtTT)eKY``@|mgpSm@RW*(K4}fMe(D2_6f;)Dt|4e&1Pv zD0M>O_3TarJVP~UvKa6^Cz+ipgO<)b!rK$+zDIbsj*;N5`i0fR7oIvs2RvIJhh8{| z_lVTQ&-XWX3VtB2f8C}4yN zons4(Vk^cNc7#oGK0u+XMxo26(8*w*@rm#OI2(9}aJa{uL@?p7)?buTRT?Y;l)Ig4^sT^N0VxDYS+n@(sge=*rG=C~1p#5_mUkSkoX;9wPZxT1dftl=)cz^;D) DhXG&$ diff --git a/bin/R2D2.class b/bin/R2D2.class deleted file mode 100644 index 99b8a3294c8944ca0b1d5819ad1952bc9bc3b1eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2683 zcmb7GTUQfT6#h=G5XOSmXhjeaMI@A1t7scR1*N79V8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exceptions/roboter/Robot.class deleted file mode 100644 index a728b70a3656d999209a1913acd38cd9820f1289..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmX^0Z`VEs1_oOOZgvJHMh2OZf>iy~isaOSlFa#5eE)7klw$JQ++#h!{8Vz^$y4TC%pJTg7Md-~;$j#@Qwc z7cc$V$;^DeuV3FEp8&2g%+Vs8#|yVjNx$aw;YPCjpcKieI)d3 zovI6$Doe4GZF616=`R}LQr7-MyB8pV|4oT)zwoc2q{ldsPQt02Eew7De*#ws diff --git a/bin/tpe/exceptions/roboter/RobotInstructions.class b/bin/tpe/exceptions/roboter/RobotInstructions.class deleted file mode 100644 index 17111db9677803d56e48c1e3fd9928fededcb007..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 291 zcmZ{f%L;-(6o&sXFJ%{6^$fOY+DFR*AqaBWN@XxjMj6NG*;@1fJydjbVM4Sz_y7CP z>-~5F*kb0uVDNM)xVXon)M+6ru8OG8Lh(}*eOYN$$L+*{$uQ5tTgdZJCj1y>BGwF6 zRf_P+u<*|Q^6;GpTBS1CFu1!;-NA@q{fF2y(ZahkV(3dMiD5U4vrn2qQL9+&(_9ew j$Lp%GVKXoc=vBZV>lSRP9jZ)qGG~HZcAOQv@^l)!`MHV z4Pli37i~<)Ztd2UJU8L>!C&&r0F6@!pL_tMQs5Fz#i^YKl8ZOAUL}Z-iH0%cpe@?j O^@-GDafGgDgx)t?!&9;V diff --git a/bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class b/bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class deleted file mode 100644 index b9a61a1095039e440e3222250b1ae21a73cc259a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 371 zcmbtQ!Ab)`41L+|cI#Sg@dt`G_27JfwHIkYSS+;C`|KL(lyRp_r{ZsU5Mn6YF7=|?~eyMpKjB7T^yUGRjf2CQJZms2|w)3C^kAK^9 zq=f!TKWk-mvsBY+#dRRGho&)ML};CzF9_+4d*A{s9CVSPP3V=T;k)fq#r|GbmI)`N ztF>KdZzBH@)9`3Egi-k)k5`0Z?zX<>iHVyA`_H+Im*5oQTRsGd6#WY3!qkof*~J?= auOcKU1Y;R8a46W_<(b4IVT5DB1if#Qe_*Tt diff --git a/bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class b/bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class deleted file mode 100644 index 36198c62d92ff8abec4cffc9c5d34ace8a9bee6a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 365 zcmbVIu};H441G?M2120~J3}{M;C3i16-)snsIp%Ut6UXw)%Ak-EhZ!eK7fxx_$rWC zy0AR^J=^lLKfm5T0Gwl#BO#oIB`bb0ybRX0E9G770{g$xU6ii%+?q-^9bf)7=ST^o zg?`qm(d}H_)(bX)(4W}Wh6_UP@TelBQ}@6Hde|NyL!U4#ZOb>^Q_X&+>xK#Yr8Byz zw6~G}h-rAVE5fAwzr!;^aql{B_{zpT2b)egiC16@@hrcAM2cPob75-Df$aDVTdyJ{ XC Date: Mon, 9 Jan 2023 13:04:32 +0100 Subject: [PATCH 2/5] added Robotexception getLastException --- src/main/java/roboter/C3PO.java | 6 ++++-- src/main/java/roboter/R2D2.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/roboter/C3PO.java b/src/main/java/roboter/C3PO.java index 8927458..69dec7a 100644 --- a/src/main/java/roboter/C3PO.java +++ b/src/main/java/roboter/C3PO.java @@ -2,6 +2,7 @@ package roboter; import roboter.exceptions.RobotException; +import java.util.ArrayList; import java.util.Arrays; import java.util.stream.Collectors; @@ -9,7 +10,8 @@ public class C3PO implements Robot { private int id; private String name; private boolean isPowerOn=false; - + ArrayList exceptionList=new ArrayList<>(); + public C3PO(int id, String name){ this.id=id; this.name=name; @@ -42,7 +44,7 @@ public C3PO(int id, String name){ @Override public RobotException getLastException() { - return null; + return exceptionList.get(exceptionList.size()-1); } @Override diff --git a/src/main/java/roboter/R2D2.java b/src/main/java/roboter/R2D2.java index 41de9f8..93895d6 100644 --- a/src/main/java/roboter/R2D2.java +++ b/src/main/java/roboter/R2D2.java @@ -2,6 +2,7 @@ package roboter; import roboter.exceptions.RobotException; +import java.util.ArrayList; import java.util.Arrays; import java.util.stream.Collectors; @@ -9,7 +10,8 @@ public class R2D2 implements Robot { private int id; private String name; private boolean isPowerOn; - + ArrayList exceptionList=new ArrayList<>(); + public R2D2(int id, String name){ this.id=id; this.name=name; @@ -43,7 +45,7 @@ public class R2D2 implements Robot { @Override public RobotException getLastException() { - return null; + return exceptionList.get(exceptionList.size()-1); } @Override From 48a7b45a65e63300a87c5ddf95a0faac63349178 Mon Sep 17 00:00:00 2001 From: Eline Date: Mon, 9 Jan 2023 13:47:19 +0100 Subject: [PATCH 3/5] added more test examples --- src/test/java/roboter/R2D2Test.java | 31 ++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/test/java/roboter/R2D2Test.java b/src/test/java/roboter/R2D2Test.java index 12338e9..fa2ea19 100644 --- a/src/test/java/roboter/R2D2Test.java +++ b/src/test/java/roboter/R2D2Test.java @@ -37,8 +37,37 @@ public class R2D2Test { var list = new int[]{12,6,7,10,18,2}; Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboter2"); - Assert.assertEquals("2,6,7,10,12,18",robot.speak(list)); + + var list1 = new int[] {17,10,19,1,4,2,7}; + Assert.assertEquals("1,2,4,7,10,17,19", robot.speak(list)); + + var list2 = new int[] {3,17,7,20,5,15,8}; + Assert.assertEquals("3,5,7,8,15,17,20", robot.speak(list)); + + var list3 = new int[] {13,8,5,12,1,9,7}; + Assert.assertEquals("1,5,7,8,9,12,13", robot.speak(list)); + + var list4 = new int[] {18,4,21,7,3,2,9}; + Assert.assertEquals("2,3,4,7,9,18,21", robot.speak(list)); + + var list5 = new int[] {13,23,8,4,22,6}; + Assert.assertEquals("4,6,8,13,22,23", robot.speak(list)); + + var list6 = new int[] {10,9,8,7,6,5}; + Assert.assertEquals("5,6,7,8,9,10", robot.speak(list)); + + var list7 = new int[] {1,2,3,5,4,6}; + Assert.assertEquals("1,2,3,4,5,6", robot.speak(list)); + + var list8 = new int[] {20,19,18,17,16,15}; + Assert.assertEquals("15,16,17,18,19,20", robot.speak(list)); + + var list9 = new int[] {15,1,13,10,7,4}; + Assert.assertEquals("1,4,7,10,13,15", robot.speak(list)); + + var list10 = new int[] {10,15,11,8,5,6,}; + Assert.assertEquals("5,6,8,10,11,15", robot.speak(list)); } } From e03596ecf207749c5f370ef7d333e33a46e152b1 Mon Sep 17 00:00:00 2001 From: Eline Date: Mon, 9 Jan 2023 13:55:50 +0100 Subject: [PATCH 4/5] C3PO Test --- src/test/java/roboter/C3POTest.java | 68 +++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/test/java/roboter/C3POTest.java diff --git a/src/test/java/roboter/C3POTest.java b/src/test/java/roboter/C3POTest.java new file mode 100644 index 0000000..8782ee1 --- /dev/null +++ b/src/test/java/roboter/C3POTest.java @@ -0,0 +1,68 @@ +package test.java.roboter; + +import org.junit.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DynamicNode; +import roboter.exceptions.RobotException; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Properties; + +public class C3POTest { + + private final ByteArrayOutputStream out = new ByteArrayOutputStream(); + private final ByteArrayOutputStream err = new ByteArrayOutputStream(); + private final PrintStream originalOut = System.out; + private final PrintStream originalErr = System.err; + + @Before + public void setStreams() { + System.setOut(new PrintStream(out)); + System.setErr(new PrintStream(err)); + } + + @After + public void restoreInitialStreams() { + System.setOut(originalOut); + System.setErr(originalErr); + } + @Test + public void sortieren() throws RobotException { + var list = new int[]{12,6,7,10,18,2}; + Robot robot= RobotFactory.getRobot(Typ.C3PO,"roboter1"); + + Assert.assertEquals("18,12,10,7,6,2",robot.speak(list)); + + var list1 = new int[] {17,10,19,1,4,2,7}; + Assert.assertEquals("19,17,10,7,4,2,1", robot.speak(list)); + + var list2 = new int[] {3,17,7,20,5,15,8}; + Assert.assertEquals("20,17,15,8,7,5,3", robot.speak(list)); + + var list3 = new int[] {13,8,5,12,1,9,7}; + Assert.assertEquals("13,12,9,8,7,5,1", robot.speak(list)); + + var list4 = new int[] {18,4,21,7,3,2,9}; + Assert.assertEquals("21,18,9,7,4,3,2", robot.speak(list)); + + var list5 = new int[] {13,23,8,4,22,6}; + Assert.assertEquals("23,22,13,8,6,4", robot.speak(list)); + + var list6 = new int[] {10,9,8,7,6,5}; + Assert.assertEquals("10,9,8,7,6,5", robot.speak(list)); + + var list7 = new int[] {1,2,3,5,4,6}; + Assert.assertEquals("6,5,4,3,2,1", robot.speak(list)); + + var list8 = new int[] {20,19,18,17,16,15}; + Assert.assertEquals("20,19,18,17,16,15", robot.speak(list)); + + var list9 = new int[] {15,1,13,10,7,4}; + Assert.assertEquals("15,13,10,7,4,1", robot.speak(list)); + + var list10 = new int[] {10,15,11,8,5,6,}; + Assert.assertEquals("15,11,10,8,6,5", robot.speak(list)); + } +} From cd575ccf87b7525b284cf9cfc0a675ee2a77d102 Mon Sep 17 00:00:00 2001 From: Eline Date: Mon, 9 Jan 2023 14:09:00 +0100 Subject: [PATCH 5/5] test correction --- src/main/java/roboter/R2D2.java | 2 -- src/test/java/roboter/C3POTest.java | 2 +- src/test/java/roboter/R2D2Test.java | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/roboter/R2D2.java b/src/main/java/roboter/R2D2.java index 93895d6..71db3b9 100644 --- a/src/main/java/roboter/R2D2.java +++ b/src/main/java/roboter/R2D2.java @@ -17,8 +17,6 @@ public class R2D2 implements Robot { this.name=name; } - - @Override public int getId() { return id; diff --git a/src/test/java/roboter/C3POTest.java b/src/test/java/roboter/C3POTest.java index 8782ee1..67e6a6d 100644 --- a/src/test/java/roboter/C3POTest.java +++ b/src/test/java/roboter/C3POTest.java @@ -31,7 +31,7 @@ public class C3POTest { @Test public void sortieren() throws RobotException { var list = new int[]{12,6,7,10,18,2}; - Robot robot= RobotFactory.getRobot(Typ.C3PO,"roboter1"); + Robot robot= RobotFactory.getRobot(Typ.C3PO,"roboter2"); Assert.assertEquals("18,12,10,7,6,2",robot.speak(list)); diff --git a/src/test/java/roboter/R2D2Test.java b/src/test/java/roboter/R2D2Test.java index fa2ea19..6501435 100644 --- a/src/test/java/roboter/R2D2Test.java +++ b/src/test/java/roboter/R2D2Test.java @@ -35,7 +35,7 @@ public class R2D2Test { @Test public void sortieren() throws RobotException { var list = new int[]{12,6,7,10,18,2}; - Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboter2"); + Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboterX"); Assert.assertEquals("2,6,7,10,12,18",robot.speak(list));