From 42d4f44e02882c21bf921e457bd26d90f63fc28e Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Thu, 5 Jan 2023 18:16:25 +0100 Subject: [PATCH 01/13] R2D2 Sortieralgorithmus angepasst --- src/R2D2.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/R2D2.java b/src/R2D2.java index 502f6fa..4deef9a 100644 --- a/src/R2D2.java +++ b/src/R2D2.java @@ -57,16 +57,16 @@ public class R2D2 implements Robot { } @Override public int[] think(int[] zahlen) throws RobotException { - int n = zahlen.length; - for (int i = 1; i < n; ++i) { - int key = zahlen[i]; - int j = i - 1; - while (j >= 0 && zahlen[j] > key) { - zahlen[j + 1] = zahlen[j]; - j = j - 1; + for (int i = 0; i < zahlen.length - 1; i++) { + for (int j = i + 1; j < zahlen.length; j++) { + if (zahlen[i] > zahlen[j]) { + int temp = zahlen[i]; + zahlen[i] = zahlen[j]; + zahlen[j] = temp; + } } - zahlen[j + 1] = key; } + return zahlen; } } From 6415b936c71637bb5b2eb93acd0fe0839e8bfc1e Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Thu, 5 Jan 2023 18:48:22 +0100 Subject: [PATCH 02/13] R2D2 Sortieralgorithmus angepasst --- src/Nexus6.java | 43 +++++-------------- .../roboter/exceptions/RobotException.java | 3 ++ .../RobotIllegalStateException.java | 9 +++- 3 files changed, 22 insertions(+), 33 deletions(-) diff --git a/src/Nexus6.java b/src/Nexus6.java index 1338ab1..66db374 100644 --- a/src/Nexus6.java +++ b/src/Nexus6.java @@ -19,10 +19,11 @@ public class Nexus6 implements Robot { public static Nexus6 getInstance() { - if (instance == null) - instance = new Nexus6(); - return instance; - } + if (instance == null) { + instance = new Nexus6(); + } + return instance; + } @Override @@ -37,11 +38,7 @@ public class Nexus6 implements Robot { @Override public void triggerPowerSwitch() { - if(isPowerOn==false){ - isPowerOn=true; - }else{ - isPowerOn=false; - } + } @@ -56,33 +53,15 @@ public class Nexus6 implements Robot { } @Override - public String speak(int[] zahlen) /*throws RobotIllegalStateException */{ + public String speak(int[] zahlen) throws RobotIllegalStateException { + throw new RobotIllegalStateException(this); - var sortiert = think(zahlen); - - return arrayFormatieren(sortiert); } - private String arrayFormatieren(int[] zahlen){ - var ergebnis = Arrays.stream(zahlen) - .boxed() - .map(String::valueOf) - .collect(Collectors.joining(",")); - return ergebnis; - } + @Override - public int[] think(int[] zahlen) /*throws RobotIllegalStateException*/ { - int n = zahlen.length; - for (int i = 1; i < n; ++i) { - int key = zahlen[i]; - int j = i - 1; - while (j >= 0 && zahlen[j] < key) { - zahlen[j + 1] = zahlen[j]; - j = j - 1; - } - zahlen[j + 1] = key; - } - return zahlen; + public int[] think(int[] zahlen) throws RobotIllegalStateException { + throw new RobotIllegalStateException(this); } diff --git a/src/tpe/exceptions/roboter/exceptions/RobotException.java b/src/tpe/exceptions/roboter/exceptions/RobotException.java index 435b2ed..df41be7 100644 --- a/src/tpe/exceptions/roboter/exceptions/RobotException.java +++ b/src/tpe/exceptions/roboter/exceptions/RobotException.java @@ -1,4 +1,7 @@ package tpe.exceptions.roboter.exceptions; public class RobotException extends Exception{ + public RobotException(String errormessage) { + super(errormessage); + } } diff --git a/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java b/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java index 788ecf5..f0e751c 100644 --- a/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java +++ b/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java @@ -1,4 +1,11 @@ package tpe.exceptions.roboter.exceptions; -public class RobotIllegalStateException { +import tpe.exceptions.roboter.Robot; + +public class RobotIllegalStateException extends RobotException { + + public RobotIllegalStateException(Robot roboter) { + + super("Fehler von : " + roboter.getName()); + } } From bd3a5c4c2b0762c7b5216d3fff8b6520b1037d4c Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Thu, 5 Jan 2023 19:03:42 +0100 Subject: [PATCH 03/13] RobotFactoryImplemented --- src/C3PO.java | 7 +++++-- src/R2D2.java | 5 +++++ src/RobotFactory.java | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/RobotFactory.java diff --git a/src/C3PO.java b/src/C3PO.java index fdc0ce8..54499b3 100644 --- a/src/C3PO.java +++ b/src/C3PO.java @@ -7,9 +7,12 @@ import java.util.stream.Collectors; public class C3PO implements Robot { private int id; private String name; - private boolean isPowerOn; - + private boolean isPowerOn=false; +public C3PO(int id, String name){ + this.id=id; + this.name=name; +} @Override public int getId() { diff --git a/src/R2D2.java b/src/R2D2.java index 4deef9a..104def9 100644 --- a/src/R2D2.java +++ b/src/R2D2.java @@ -9,6 +9,11 @@ public class R2D2 implements Robot { private String name; private boolean isPowerOn; + public R2D2(int id, String name){ + this.id=id; + this.name=name; + } + @Override diff --git a/src/RobotFactory.java b/src/RobotFactory.java new file mode 100644 index 0000000..052efd9 --- /dev/null +++ b/src/RobotFactory.java @@ -0,0 +1,21 @@ +import tpe.exceptions.roboter.Robot; + +public class RobotFactory { + private static int R2D2Id=0; + private static int C2POId=10000; + public static Robot getRobot(String typ){ + switch (typ){ + case "R2D2": + return new R2D2(R2D2Id++,"blah"); + + case "C3PO": + return new C3PO(C2POId++,"blah"); + + case "Nexus6": + return Nexus6.getInstance(); + + } + return null; + } + +} From 023365e6539cec8310a11316cd2073e3e8fb3e0c Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Fri, 6 Jan 2023 14:41:58 +0100 Subject: [PATCH 04/13] tests --- RobotAbgabe.iml | 13 ++++++++- src/RobotFactory.java | 21 -------------- src/{ => main/java/roboter}/C3PO.java | 5 ++-- src/{ => main/java/roboter}/Nexus6.java | 9 +++--- src/{ => main/java/roboter}/R2D2.java | 5 ++-- .../java}/roboter/Robot.java | 2 +- .../java}/roboter/RobotControl.java | 5 ++-- src/main/java/roboter/RobotFactory.java | 22 ++++++++++++++ .../java}/roboter/RobotInstructions.java | 8 ++--- src/main/java/roboter/Typ.java | 5 ++++ .../roboter/exceptions/RobotException.java | 2 +- .../RobotIllegalStateException.java | 6 ++-- .../exceptions/RobotMagicValueException.java | 2 +- src/test/java/roboter/ExceptionTest.java | 29 +++++++++++++++++++ src/test/java/roboter/FactoryTest.java | 29 +++++++++++++++++++ 15 files changed, 120 insertions(+), 43 deletions(-) delete mode 100644 src/RobotFactory.java rename src/{ => main/java/roboter}/C3PO.java (94%) rename src/{ => main/java/roboter}/Nexus6.java (82%) rename src/{ => main/java/roboter}/R2D2.java (94%) rename src/{tpe/exceptions => main/java}/roboter/Robot.java (87%) rename src/{tpe/exceptions => main/java}/roboter/RobotControl.java (96%) create mode 100644 src/main/java/roboter/RobotFactory.java rename src/{tpe/exceptions => main/java}/roboter/RobotInstructions.java (89%) create mode 100644 src/main/java/roboter/Typ.java rename src/{tpe/exceptions => main/java}/roboter/exceptions/RobotException.java (75%) rename src/{tpe/exceptions => main/java}/roboter/exceptions/RobotIllegalStateException.java (69%) rename src/{tpe/exceptions => main/java}/roboter/exceptions/RobotMagicValueException.java (50%) create mode 100644 src/test/java/roboter/ExceptionTest.java create mode 100644 src/test/java/roboter/FactoryTest.java diff --git a/RobotAbgabe.iml b/RobotAbgabe.iml index c90834f..850fc7d 100644 --- a/RobotAbgabe.iml +++ b/RobotAbgabe.iml @@ -3,9 +3,20 @@ - + + + + + + + + + + + + \ No newline at end of file diff --git a/src/RobotFactory.java b/src/RobotFactory.java deleted file mode 100644 index 052efd9..0000000 --- a/src/RobotFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -import tpe.exceptions.roboter.Robot; - -public class RobotFactory { - private static int R2D2Id=0; - private static int C2POId=10000; - public static Robot getRobot(String typ){ - switch (typ){ - case "R2D2": - return new R2D2(R2D2Id++,"blah"); - - case "C3PO": - return new C3PO(C2POId++,"blah"); - - case "Nexus6": - return Nexus6.getInstance(); - - } - return null; - } - -} diff --git a/src/C3PO.java b/src/main/java/roboter/C3PO.java similarity index 94% rename from src/C3PO.java rename to src/main/java/roboter/C3PO.java index 54499b3..8927458 100644 --- a/src/C3PO.java +++ b/src/main/java/roboter/C3PO.java @@ -1,5 +1,6 @@ -import tpe.exceptions.roboter.Robot; -import tpe.exceptions.roboter.exceptions.RobotException; +package roboter; + +import roboter.exceptions.RobotException; import java.util.Arrays; import java.util.stream.Collectors; diff --git a/src/Nexus6.java b/src/main/java/roboter/Nexus6.java similarity index 82% rename from src/Nexus6.java rename to src/main/java/roboter/Nexus6.java index 66db374..dd1b97b 100644 --- a/src/Nexus6.java +++ b/src/main/java/roboter/Nexus6.java @@ -1,9 +1,8 @@ -import tpe.exceptions.roboter.Robot; -import tpe.exceptions.roboter.exceptions.RobotException; -import tpe.exceptions.roboter.exceptions.RobotIllegalStateException; +package roboter; -import java.util.Arrays; -import java.util.stream.Collectors; +import roboter.exceptions.RobotException; +import roboter.exceptions.RobotIllegalStateException; +import roboter.exceptions.RobotException; public class Nexus6 implements Robot { diff --git a/src/R2D2.java b/src/main/java/roboter/R2D2.java similarity index 94% rename from src/R2D2.java rename to src/main/java/roboter/R2D2.java index 104def9..41de9f8 100644 --- a/src/R2D2.java +++ b/src/main/java/roboter/R2D2.java @@ -1,5 +1,6 @@ -import tpe.exceptions.roboter.Robot; -import tpe.exceptions.roboter.exceptions.RobotException; +package roboter; + +import roboter.exceptions.RobotException; import java.util.Arrays; import java.util.stream.Collectors; diff --git a/src/tpe/exceptions/roboter/Robot.java b/src/main/java/roboter/Robot.java similarity index 87% rename from src/tpe/exceptions/roboter/Robot.java rename to src/main/java/roboter/Robot.java index 61069b4..57f3f28 100644 --- a/src/tpe/exceptions/roboter/Robot.java +++ b/src/main/java/roboter/Robot.java @@ -1,6 +1,6 @@ /* (c) 2012 Thomas Smits */ -package tpe.exceptions.roboter; +package roboter; /** * Interface für Roboter. diff --git a/src/tpe/exceptions/roboter/RobotControl.java b/src/main/java/roboter/RobotControl.java similarity index 96% rename from src/tpe/exceptions/roboter/RobotControl.java rename to src/main/java/roboter/RobotControl.java index 5e9ab20..651882d 100644 --- a/src/tpe/exceptions/roboter/RobotControl.java +++ b/src/main/java/roboter/RobotControl.java @@ -1,7 +1,8 @@ -package tpe.exceptions.roboter; +package roboter; -import tpe.exceptions.roboter.exceptions.RobotException; +import roboter.exceptions.RobotException; +import roboter.exceptions.RobotException; /** * Das Interface repräsentiert einen einfachen Roboter mit seinen Funktionen. diff --git a/src/main/java/roboter/RobotFactory.java b/src/main/java/roboter/RobotFactory.java new file mode 100644 index 0000000..5b2845c --- /dev/null +++ b/src/main/java/roboter/RobotFactory.java @@ -0,0 +1,22 @@ +package roboter; + +public class RobotFactory { + private static int R2D2Id=0; + private static int C2POId=10000; + + public static Robot getRobot(Typ typ,String name){ + switch (typ){ + case R2D2: + return new R2D2(R2D2Id++,name); + + case C3PO: + return new C3PO(C2POId++,name); + + case Nexus6: + return Nexus6.getInstance(); + + } + return null; + } + +} diff --git a/src/tpe/exceptions/roboter/RobotInstructions.java b/src/main/java/roboter/RobotInstructions.java similarity index 89% rename from src/tpe/exceptions/roboter/RobotInstructions.java rename to src/main/java/roboter/RobotInstructions.java index 4085249..374bec5 100644 --- a/src/tpe/exceptions/roboter/RobotInstructions.java +++ b/src/main/java/roboter/RobotInstructions.java @@ -1,9 +1,9 @@ -package tpe.exceptions.roboter; +package roboter; -import tpe.exceptions.roboter.exceptions.RobotException; -import tpe.exceptions.roboter.exceptions.RobotIllegalStateException; -import tpe.exceptions.roboter.exceptions.RobotMagicValueException; +import roboter.exceptions.RobotException; +import roboter.exceptions.RobotIllegalStateException; +import roboter.exceptions.RobotMagicValueException; /** * Das Interface repräsentiert den Befehlssatz eines einfachen Roboters. diff --git a/src/main/java/roboter/Typ.java b/src/main/java/roboter/Typ.java new file mode 100644 index 0000000..22df119 --- /dev/null +++ b/src/main/java/roboter/Typ.java @@ -0,0 +1,5 @@ +package roboter; + +public enum Typ { + R2D2,C3PO,Nexus6 +} diff --git a/src/tpe/exceptions/roboter/exceptions/RobotException.java b/src/main/java/roboter/exceptions/RobotException.java similarity index 75% rename from src/tpe/exceptions/roboter/exceptions/RobotException.java rename to src/main/java/roboter/exceptions/RobotException.java index df41be7..190cb72 100644 --- a/src/tpe/exceptions/roboter/exceptions/RobotException.java +++ b/src/main/java/roboter/exceptions/RobotException.java @@ -1,4 +1,4 @@ -package tpe.exceptions.roboter.exceptions; +package roboter.exceptions; public class RobotException extends Exception{ public RobotException(String errormessage) { diff --git a/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java b/src/main/java/roboter/exceptions/RobotIllegalStateException.java similarity index 69% rename from src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java rename to src/main/java/roboter/exceptions/RobotIllegalStateException.java index f0e751c..9ab52ae 100644 --- a/src/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.java +++ b/src/main/java/roboter/exceptions/RobotIllegalStateException.java @@ -1,7 +1,7 @@ -package tpe.exceptions.roboter.exceptions; - -import tpe.exceptions.roboter.Robot; +package roboter.exceptions; +import roboter.Robot; +import roboter.exceptions.*; public class RobotIllegalStateException extends RobotException { public RobotIllegalStateException(Robot roboter) { diff --git a/src/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java b/src/main/java/roboter/exceptions/RobotMagicValueException.java similarity index 50% rename from src/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java rename to src/main/java/roboter/exceptions/RobotMagicValueException.java index 922fdd0..6c47b7a 100644 --- a/src/tpe/exceptions/roboter/exceptions/RobotMagicValueException.java +++ b/src/main/java/roboter/exceptions/RobotMagicValueException.java @@ -1,4 +1,4 @@ -package tpe.exceptions.roboter.exceptions; +package roboter.exceptions; public class RobotMagicValueException { } diff --git a/src/test/java/roboter/ExceptionTest.java b/src/test/java/roboter/ExceptionTest.java new file mode 100644 index 0000000..4c1a8de --- /dev/null +++ b/src/test/java/roboter/ExceptionTest.java @@ -0,0 +1,29 @@ +package roboter; + +import org.junit.Assert; +import org.junit.Test; +import roboter.exceptions.RobotIllegalStateException; + +public class ExceptionTest { + @Test + public void testNexus6Speak(){ + Nexus6 robot = Nexus6.getInstance(); + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot.speak(new int[]{1,2,3,4}); + }); + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot.think(new int[]{1,2,3,4}); + }); + + + } + @Test + public void testNexus6Trigger(){ + Nexus6 robot = Nexus6.getInstance(); + boolean isPowerOn = robot.isPowerOn(); + robot.triggerPowerSwitch(); + Assert.assertEquals(isPowerOn, robot.isPowerOn()); + } + + +} diff --git a/src/test/java/roboter/FactoryTest.java b/src/test/java/roboter/FactoryTest.java new file mode 100644 index 0000000..cad4339 --- /dev/null +++ b/src/test/java/roboter/FactoryTest.java @@ -0,0 +1,29 @@ +package roboter; + +import org.junit.Assert; +import org.junit.Test; + +public class FactoryTest { + @Test + public void singletonNexus6(){ + Nexus6 roboter1 = Nexus6.getInstance(); + Nexus6 roboter2=Nexus6.getInstance(); + Assert.assertEquals(roboter1,roboter2); + } + @Test + public void factoryMethodTest(){ + Robot robot1=RobotFactory.getRobot(Typ.R2D2,"roboterX"); + Assert.assertTrue(robot1 instanceof R2D2); + Robot robot2=RobotFactory.getRobot(Typ.C3PO,"roboter2"); + Assert.assertTrue(robot2 instanceof C3PO); + + Assert.assertEquals(robot1.getName(),"roboterX"); + Assert.assertEquals(robot2.getName(),"roboter2"); + + + } + + + + +} From b646f251a5c657660451596a58dbb55d340621b7 Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Mon, 9 Jan 2023 11:50:10 +0100 Subject: [PATCH 05/13] Sortieren R2D2tests --- RobotAbgabe.iml | 16 +++++++++ src/main/java/roboter/Nexus6.java | 15 ++++++--- src/main/java/roboter/RobotFactory.java | 7 ++++ src/test/java/roboter/FactoryTest.java | 1 + src/test/java/roboter/R2D2Test.java | 44 +++++++++++++++++++++++++ 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/test/java/roboter/R2D2Test.java diff --git a/RobotAbgabe.iml b/RobotAbgabe.iml index 850fc7d..901477e 100644 --- a/RobotAbgabe.iml +++ b/RobotAbgabe.iml @@ -18,5 +18,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/roboter/Nexus6.java b/src/main/java/roboter/Nexus6.java index dd1b97b..06cff81 100644 --- a/src/main/java/roboter/Nexus6.java +++ b/src/main/java/roboter/Nexus6.java @@ -4,12 +4,14 @@ import roboter.exceptions.RobotException; import roboter.exceptions.RobotIllegalStateException; import roboter.exceptions.RobotException; +import java.util.ArrayList; + public class Nexus6 implements Robot { private int id = 19281982; private String name = "pris"; private boolean isPowerOn = false; - + ArrayList exceptionList=new ArrayList<>(); private static Nexus6 instance = new Nexus6(); @@ -48,19 +50,24 @@ public class Nexus6 implements Robot { @Override public RobotException getLastException() { - return null; + return exceptionList.get(exceptionList.size()-1); } @Override public String speak(int[] zahlen) throws RobotIllegalStateException { - throw new RobotIllegalStateException(this); + var newException = new RobotIllegalStateException(this); + exceptionList.add(newException); + throw newException; } @Override public int[] think(int[] zahlen) throws RobotIllegalStateException { - throw new RobotIllegalStateException(this); + var newException2=new RobotIllegalStateException(this); + exceptionList.add(newException2); + throw newException2; + } diff --git a/src/main/java/roboter/RobotFactory.java b/src/main/java/roboter/RobotFactory.java index 5b2845c..af67b8a 100644 --- a/src/main/java/roboter/RobotFactory.java +++ b/src/main/java/roboter/RobotFactory.java @@ -4,6 +4,13 @@ public class RobotFactory { private static int R2D2Id=0; private static int C2POId=10000; + /** + * Dies ist eine Factory methode, mit der man einen Roboter + * mit einem bestimmten typ und namen generieren lassen kann + * @param typ Typ vom Roboter + * @param name Name vom Roboter + * @return ein Roboter Objekt + */ public static Robot getRobot(Typ typ,String name){ switch (typ){ case R2D2: diff --git a/src/test/java/roboter/FactoryTest.java b/src/test/java/roboter/FactoryTest.java index cad4339..f20de78 100644 --- a/src/test/java/roboter/FactoryTest.java +++ b/src/test/java/roboter/FactoryTest.java @@ -26,4 +26,5 @@ public class FactoryTest { + } diff --git a/src/test/java/roboter/R2D2Test.java b/src/test/java/roboter/R2D2Test.java new file mode 100644 index 0000000..12338e9 --- /dev/null +++ b/src/test/java/roboter/R2D2Test.java @@ -0,0 +1,44 @@ +package 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 R2D2Test { + + 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.R2D2,"roboter2"); + + + Assert.assertEquals("2,6,7,10,12,18",robot.speak(list)); + } + +} From 50104496daf12cd92b6f4775610bb91549eb36f0 Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Mon, 9 Jan 2023 11:56:32 +0100 Subject: [PATCH 06/13] Sortieren C3POtests --- out/production/RobotAbgabe/roboter/C3PO.class | Bin 0 -> 2720 bytes out/production/RobotAbgabe/roboter/Nexus6.class | Bin 0 -> 1892 bytes out/production/RobotAbgabe/roboter/R2D2.class | Bin 0 -> 2685 bytes out/production/RobotAbgabe/roboter/Robot.class | Bin 0 -> 160 bytes .../RobotAbgabe/roboter/RobotControl.class | Bin 0 -> 304 bytes .../RobotAbgabe/roboter/RobotFactory$1.class | Bin 0 -> 676 bytes .../RobotAbgabe/roboter/RobotFactory.class | Bin 0 -> 1006 bytes .../RobotAbgabe/roboter/RobotInstructions.class | Bin 0 -> 261 bytes out/production/RobotAbgabe/roboter/Typ.class | Bin 0 -> 979 bytes .../roboter/exceptions/RobotException.class | Bin 0 -> 377 bytes .../exceptions/RobotIllegalStateException.class | Bin 0 -> 972 bytes .../exceptions/RobotMagicValueException.class | Bin 0 -> 335 bytes .../RobotAbgabe/roboter/C3PoSortierungTest.class | Bin 0 -> 1219 bytes out/test/RobotAbgabe/roboter/ExceptionTest.class | Bin 0 -> 2009 bytes out/test/RobotAbgabe/roboter/FactoryTest.class | Bin 0 -> 1181 bytes out/test/RobotAbgabe/roboter/R2D2Test.class | Bin 0 -> 1134 bytes 16 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 out/production/RobotAbgabe/roboter/C3PO.class create mode 100644 out/production/RobotAbgabe/roboter/Nexus6.class create mode 100644 out/production/RobotAbgabe/roboter/R2D2.class create mode 100644 out/production/RobotAbgabe/roboter/Robot.class create mode 100644 out/production/RobotAbgabe/roboter/RobotControl.class create mode 100644 out/production/RobotAbgabe/roboter/RobotFactory$1.class create mode 100644 out/production/RobotAbgabe/roboter/RobotFactory.class create mode 100644 out/production/RobotAbgabe/roboter/RobotInstructions.class create mode 100644 out/production/RobotAbgabe/roboter/Typ.class create mode 100644 out/production/RobotAbgabe/roboter/exceptions/RobotException.class create mode 100644 out/production/RobotAbgabe/roboter/exceptions/RobotIllegalStateException.class create mode 100644 out/production/RobotAbgabe/roboter/exceptions/RobotMagicValueException.class create mode 100644 out/test/RobotAbgabe/roboter/C3PoSortierungTest.class create mode 100644 out/test/RobotAbgabe/roboter/ExceptionTest.class create mode 100644 out/test/RobotAbgabe/roboter/FactoryTest.class create mode 100644 out/test/RobotAbgabe/roboter/R2D2Test.class diff --git a/out/production/RobotAbgabe/roboter/C3PO.class b/out/production/RobotAbgabe/roboter/C3PO.class new file mode 100644 index 0000000000000000000000000000000000000000..124a63f5a68369aae392da3e6b4d2aaf21634908 GIT binary patch literal 2720 zcma)8TUQfT6#h;w420n#C0H*Ah!+S*Y^_ucU^PNb8^DUvR(kOy9AF@siIWLxpZhD? zx2~?`OCQ>`id7$6ed$YA|3TmSEBa#XcP0}Ug=*KVNV%Ca_4OUaZB5_o9IBNK*U<+Qcf>*nRo-;0x?^bl|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*Sw>24RV2<3)&`5Lx$f1fsffyF+JJ*K*aRS`gcwx@6c1mcRum=7LnC6 z#Ap2#;rD|lb*{cgoKL_^^*KbfnA%6WS{&a;p&H*usd|X12hVX~9~Xb|X&U^$Krkql zK#pVv3Y4F~IHoDT#1kVRMAMhc;8T1SiY-xE|4P5&(m%)_B17`azu^+sKXX3@%|FhN zz!b(f6a}i?;)+2QNb)(ZhEz4)b==A7?@0f|hXAY70wWp5kqqMySjKIh>ZC`(g`sc& zo;?-35;-7^a z{5R%LW^iMKs}u#&!dEm&r@u)qZE@)k3lCWL>#Le@{s13*H~$y+N6WCtPOG!n4WDy5 zz=fP-z}ILq!VFts6>CJU6QAJD0D+-U-DtI#HD_Q(6CV!zR=9 R5`KpT_0kP>pL;QU`!8c*YCr%0 literal 0 HcmV?d00001 diff --git a/out/production/RobotAbgabe/roboter/R2D2.class b/out/production/RobotAbgabe/roboter/R2D2.class new file mode 100644 index 0000000000000000000000000000000000000000..b7ec4b32001af6532cf14ece798fbadce9b60bf5 GIT binary patch literal 2685 zcma)8TUQfT6#h;U7zl%06s!WuMHCVwRxMuQrHWG12C$;EN-v%y$1sr0#K{D;&;E)& zy1JGxeQ4LJR(){wp-)}@hW?N)SKIGQhA-1>Az1d^O&sdj zY*|@W1Wr!WOX5dwM*DAWZ8*+;OvN#S69!J2IEB;9rYYR4Qz}s_j>}3KYYz2d7X@a5 zu)dmRSEak8?$(r@SLtmcHX!`u&Y09DC1>R8$O1>gIRs7F@(K66uG_SMk2gE*6JSZm z%D_c|&W38WdbMgY&6=59rg&$a0>#^vwQRLeE9aDZUFJ%@oSnQZElbzZ>tHiRsj>h& zvJH41iZr`gR9=QE;Q7fgC9W3yGqG#4%OQR=?8{+O%GtUKF;A5#J+a1ri)c$u&CRPhOINR5KP{%UikQMh$MM)t zS(#Vfs#B`L*78agu)$xQD1O=l`MP1Sy!p7EawW69`cUVy5pJYD2G?C!rBX* z>H)4uyHHZq16jveuT|2`jSua-;duQ)MTO1(|IK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obotInstructions.class b/out/production/RobotAbgabe/roboter/RobotInstructions.class new file mode 100644 index 0000000000000000000000000000000000000000..9963796f43d63305faf67a33155655837e5ca0a8 GIT binary patch literal 261 zcmX^0Z`VEs1_oOOK6VBsMh3~E{G|Mn)FS;L5bc>)TvAk;T#}ieSIo}9!pI?WyU5kPj{?%FIi*W@O-Utw>HSfSSR{$e;+b zA{8zUu??;cXlO}BW**Q`HjtswoBRBLg$gGYkw& fK)13oumSn(KpqQ_<^YOtF>oV`0NFeswG6xfvt&TQ literal 0 HcmV?d00001 diff --git a/out/production/RobotAbgabe/roboter/Typ.class b/out/production/RobotAbgabe/roboter/Typ.class new file mode 100644 index 0000000000000000000000000000000000000000..e183cc056bd56e9b7d3447fc04e3db5f752164ce GIT binary patch literal 979 zcmZuvZEw<06n-vkDRjkQox|bg+?)=Wg0Pn_;4(93q9McBNkaTouws|en$j-%uaqTj z(P;MBA7woEf?3IIlir@^Jm=-P=luTj{TF~I*in&SmOjB9Xbb+hxVsvxWl1qI%bh&P}kZ|n{N(GLf%d#(qQ0* zimZ+~++Lg91I#dRyna1ifhQ38mvr30GHGZyo)hje%*RtrB3~5SDJUB0TS_6F zg3f>M>v({5E>*NKWXKkZ(_$&@KcBqszayQqO~KX-VaDO!^sd2J0LIo3w|F=2bJ z{01i8Y154MrzutlLuV`N*%kctt}8Bs^&=-fwbxAOmD=#dd{(i$QdKKXzqGY#r^@M| zKh4k{+m1^ zG7CSzkFvbOLy3&e)O7c`bMLv&{_*qrJAhYsx`qT+93(Tig%rbjVA{rtpn4wd3{F?r zGd>Uuo8?O5l8<>+aow#pZ6I~m%M(dDgH^Z;I|JSqHKToQKS#?W;#@aY(r{sHX5`=aKYP(B>9H%xoYu1MtCMn+McAmtG|iS%L7CxTDbKj@ z9UL+2{a=+vZkj8KxJ~mKJ&fKg?$EkP=!7m*g7)0e@i$O3*KmNZSo=b<1h!~(C;wN; t#>F<_?WsO?aF-BSVi)&_Z3XuUCGY?bX-|`6kG>KP3AuE7f(nkY`wPPv5nTWP literal 0 HcmV?d00001 diff --git a/out/production/RobotAbgabe/roboter/exceptions/RobotMagicValueException.class b/out/production/RobotAbgabe/roboter/exceptions/RobotMagicValueException.class new file mode 100644 index 0000000000000000000000000000000000000000..7e465aaf46dc2153c82e41503e8920d66f8fe925 GIT binary patch literal 335 zcmb79yG{c^3>@Dh7mh$8`V@3L1p5Iz8U)n=Qi87ETdc6raf>#4h~J_@qTmDgD1G@r3k(T| z-Zd_;SNvl5DOlI7)GSKZdSOki+nz6fCxq<6-7{fa*^Y1e$A(l44tMLzr4~AU}8my^4^a6pUja T#irnB-RDxbgb}s{6O6wBQMFPY literal 0 HcmV?d00001 diff --git a/out/test/RobotAbgabe/roboter/C3PoSortierungTest.class b/out/test/RobotAbgabe/roboter/C3PoSortierungTest.class new file mode 100644 index 0000000000000000000000000000000000000000..a0eb51e22ee13bc3ae2c9e3bf3d49447aa365c37 GIT binary patch literal 1219 zcmZWpYfsZq7=F%f9i^}`U|f}pC>tPSfLtsn2qVD^XBZ(Fd@AE)7DkJ0XXLN&2aF%Z zMDP;*XySj;_@3?tS<{@$d)~|QJnw1${QLG3z$&(6_~4fiP!L3jK|Rsm>B*9A7L(bd z6JBr`LMw)8xX&2;@x*=$!f25oD`UWC?y7}&uRUT> zB_tF~V3Imv*~R2ZnWRrv$}=bxwCT5Hz2q>A$8RO6bW3ZtB=%)I#k`vBW~{rr5K_atDu+mb=wg8sxjcc zF(`Df-j-(JHHH?a(h6=;{*ob@;XB-B2zr`{Vt2%&h&BRMINj0Dy*d(>8RYc)0zdb< zCt;0Yq!z>L_N1qM-H)Mfw`{t`8Q(V?gFvsFrbT4M1t7^Y4b8;`p{n7PLaBQF<(yTv z3w+BE)O(s)O$%M=2E^!#0+`w>E+DP^AX*5~I7_=E&5Y*Y#5LF_TKF(Wqc{d6%+sh; z9Pk7Sv}0JLQ@EA^jh=j}@8# literal 0 HcmV?d00001 diff --git a/out/test/RobotAbgabe/roboter/ExceptionTest.class b/out/test/RobotAbgabe/roboter/ExceptionTest.class new file mode 100644 index 0000000000000000000000000000000000000000..66b0e279d432a02f888d21dfcd184d72a624fb30 GIT binary patch literal 2009 zcma)7ZC4vb7`+ohR+cR2yuec&#cl<{JgKZg<9X~Lg zmK4b53zgFzB@IIYcTYCu>y|tSEZ6ais|u-X+p=xiwZIJI(upn0NJk8eBFh-OjwA3m z|8Lkr#r4|7-3}uyZg-rP!YtNzJom_Q+N&MMF`Kq5>3AQPHRKG8V}i-XXXbrhdQ8?Z z!%2A37g)|$;({#NG?p$zR7e~Pu|oPR$f+uL)xZ?42@F{NOZP~6Rp!L%ZYbLa25zWM zWCPD?x1|?4)Q+s6wWH$}KGZO6;5I%I7>z?)a9vxPM9~gSyCbXH0=fJ~GK#K8Sc1HP z0%m&2F8$ImZ6Fos6=YQ^Zp*aSOwUs5 z?q-@nF#hqLC{Cf3h!YSsl4vaosy`%VJ9=j#Go2?Xm%!SWYnE@3W8QIG%28=lxyO=G zk5=61Z6 zd}f7(>Y=GP?5A*_bqZ%~2i&F>dZw_SA{o=-m^8B+& zId+j3P1~+nfh>(6!>ZJDJVf2VGc0h$XYV1_4a{SKx2Ehk(hDC0$xgA=x6hR9zp~fx zlfd=!U3rnBQsE{UQ+)WqcbRty8IGTERpeKw-I?DYe&r;EM;w(I(D0a}5jo&{;Npx2I}RkD|6-(eUy#@Ko|pN!@)XclQY>l_C$f+4e8UHbQNZ%Wb5zQvU}4%fN5sTTYk<4(+)W41t!tm7EK1TGQ(Dz1dg zHzJ%K^F)_TvT6R$A&4|>_;i2wiq literal 0 HcmV?d00001 diff --git a/out/test/RobotAbgabe/roboter/FactoryTest.class b/out/test/RobotAbgabe/roboter/FactoryTest.class new file mode 100644 index 0000000000000000000000000000000000000000..02784631f0d5f5d7fff8a8ce3fe677cbf8cdfa66 GIT binary patch literal 1181 zcmZWo+fEZv6kVqjrk5!#r6~1+ASx|I3PnLJg2*K?8NigLA-+w^Sca4totYZ>2tP(% ztUj3V>PH#Z>GTG6(sS9Dwb$C`oIihm{RZ$Fdl3XMq#&qb7$X9SGyRL6Z|GJ%e^@;; zYM#Kzx@no-hQLrJTZtfqu!4w+C{%$_$FAC*;p7jDuT6JVAX+!Pcb4nvR?QGdX0qD# zh++hzh$~2_7(y|G*2?R@poq|BD$A;Eo2zLZRow(x&?%}?IDHRVeEs*Nwm!!fyz2@1@1;eSY zZ4p??Ttge+bmTdvRWJ6nw=;?g9#UNomyBdH9;tYYCjt>)cG+pNaly<7Ur|OyR>}!( zue?7DA=f8dQ1EmBPWq$BV@biXiUL-swpU6@5KzedKtCsZis#aAYKN|Z=K|y1oQ~qM z;W9J0ZJ#hLu9=o`&^)giPFb%ub0m$CUeyG3cF|Jh+Kodj_zIL~+@ihT+*( z_tJFFV43%!m*hJcpDr~m&pbCOrfagumSx$V?wPj58VRj`e zNLv-*<30G2>J|NFUx7GiyrB!cvYIm&kzMT}Sy zaoW%7AWH8#-!kt8k#k%Hu)!$FVUx4Kn_k6lor-Ih7*D2KxU1!^Fw?^9CFYXz-0v@3 zfh1;gKe5R3Wk_tnU(!23Z3+sZ<0O~hH-E@RoGan8G$! LH)-w=F@W8Fu+Rb~ literal 0 HcmV?d00001 diff --git a/out/test/RobotAbgabe/roboter/R2D2Test.class b/out/test/RobotAbgabe/roboter/R2D2Test.class new file mode 100644 index 0000000000000000000000000000000000000000..aa9925730bd3b943c40e8790e69f483595f745f3 GIT binary patch literal 1134 zcmZuw?QRl56g>kAOXibLY;vXU;u4`{(b^-vC}=FNp}EDijSd#2NH6>yuUJSx&cL zw$FG+FvRz5#})?+(M+~Eg9K(&BsI)JW0>{awkx<-Xbk!cO3ip}Fr=#2vgHKk7!t#b zk%W#LD$*KmVu4}d3R#mp$5uzU-hkj;F2W4Mc4mUDI@VVgp6ztY+0lMjLFX+p%o+Ke z{BFLuoi7^sVrdq)v8-Z6!yViuffJ`P#QZ+DJ}@k1PEWGaCnRwn4^*sbSi?G5vPiSS;OJvu^?Zhn%r%lr8_Uy~Y*WP}q8o`J^BUYII_1!P#~J3Uw!_~B z=WXsatagtw>8jhYdQHo-<$9P@#Cw|#O^ql^?>FiLU+{A?5VfGk z%MA+pfjG4KBJgZ0xjUWXss@*AY&C6{M!$*V|L;vxM(@`-?)K%BsUe#E7+xfLaJH4 literal 0 HcmV?d00001 From adca32b401a10b6d48e6899baad43d6c9ecc48ed Mon Sep 17 00:00:00 2001 From: Eline Date: Mon, 9 Jan 2023 12:42:29 +0100 Subject: [PATCH 07/13] 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{)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;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*N79V8zlZy?Bxw!ay<;Cli!D`zzX~ zu0HV6hjuM%)dyFf+x~^V_b>Fp+V4z;FhFYCm6bWSy}$kK%h@x({PpZPfN`wF5fX^p zJahF-91(%86}cwUWoebtbNLljaN~#x^te@(Ru2lQ>YBDyOFMSnc9oO9sYij3Sriai z;#jhx1oq{&Q0867v`QI)cC&WFzOS4)i?VkFVi!%zbSDJDL#Gy~I%OAC0%7bmum`UR zbmmM;&DJY<<=m3_vIlDyWO+e4re6D-5qH_F5iO@(pqXe%xmnU7YPKB$hYZBgCJ^WT ztjBKu(5c=0v}mt^b|grjluIS$cy#CQn{HuQA0IW)0YhNVyekW|1w^v0ir3_5q63OT7 z2a3r)yqVIVu#dNob$-RbB&H}YtJU(lK;Jg`rMgwnb)BB}C**Jq@5M1KaBvrg2CRYW zU#=`ffBoi7mLb;R9ZVkpyNi7so6e*=26ZE|+-?ZHJM(fe%^8D>g5V zRT3EU&3dRw%01(j)Gv5Dh3H*eq;J|bA50nZ`|`rs#JOD9-|jlPhHtMzJTcQ**^Y*W0oUR6Qy|9;po`D)!@kbUGSSuW3;uF7=Aa93b3=#rm@pq9VY zg;D|wSTV4QGLyU}%XKxk^zZtO9BO0C+R30X-cQArxLH|&jAy#QG#gpVQqELa)@q7f z$q_iQD{ZZU9|zwbM_w(eyStYu^s_sK`H%7$(tVwGJEWVoH?li()UBE?5I#G(N^=w( zqr*R;>jzIvH-wnC8OQ6K8w~;MN0KY{T^!_dyYeHv@!byPu9nK(INUtB~!!yGpk1@K1mf$Hc%50tX5RW!weMFtPw{V6WV*I_$S%^QrxqNJnJ*-a?mEMs+!l{7}P=W&$le!j+Zu{0$bf5jFB;>iKwNVgqBT-qEp0Z=^UD-9T3=8I9cKV|4Ce^kp*o zH4ME-M!tRdhj)~W%smW?-kxt>{+iNU8`&RaCV`7wjq@fP=WN>JKha>(rJj0YinjxRXs8@0r}WmI6J${qb#aSt`rap-T1Jx*8v diff --git a/bin/tpe/exceptions/roboter/Robot.class b/bin/tpe/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 08/13] 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 09/13] 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 10/13] 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 11/13] 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)); From 93dec93db44f416b2c9725903e13ecc6b4505970 Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Mon, 9 Jan 2023 23:31:54 +0100 Subject: [PATCH 12/13] -implemented getLastException Method for all classes - implemented RobotMagicValueException for speak and think - implemented RobotIllegalStateException for the number 42 - implemented tests for the above 3 points --- out/production/RobotAbgabe/roboter/C3PO.class | Bin 2720 -> 3947 bytes .../RobotAbgabe/roboter/Nexus6.class | Bin 1892 -> 1941 bytes out/production/RobotAbgabe/roboter/R2D2.class | Bin 2685 -> 3913 bytes .../roboter/RobotInstructions.class | Bin 261 -> 314 bytes .../exceptions/RobotMagicValueException.class | Bin 335 -> 499 bytes .../RobotAbgabe/roboter/ExceptionTest.class | Bin 2009 -> 3086 bytes out/test/RobotAbgabe/roboter/R2D2Test.class | Bin 1134 -> 1185 bytes src/main/java/roboter/C3PO.java | 59 +++++++++++++----- src/main/java/roboter/Nexus6.java | 8 ++- src/main/java/roboter/R2D2.java | 35 +++++++++-- src/main/java/roboter/RobotInstructions.java | 4 +- .../exceptions/RobotMagicValueException.java | 7 ++- src/test/java/roboter/C3PoSortierungTest.java | 20 ++++++ src/test/java/roboter/ExceptionTest.java | 25 ++++++++ .../java/roboter/GetLastExceptionTest.java | 44 +++++++++++++ src/test/java/roboter/R2D2Test.java | 20 +----- 16 files changed, 181 insertions(+), 41 deletions(-) create mode 100644 src/test/java/roboter/C3PoSortierungTest.java create mode 100644 src/test/java/roboter/GetLastExceptionTest.java diff --git a/out/production/RobotAbgabe/roboter/C3PO.class b/out/production/RobotAbgabe/roboter/C3PO.class index 124a63f5a68369aae392da3e6b4d2aaf21634908..d18e1a7845ee168a0ea0d9112b9180ae6ffe8df1 100644 GIT binary patch literal 3947 zcmb7HYj+dZ72Q`4k1Y?jVvq@Tz$P}qmW@S9peZsAM!`kYMg|iTaFQ~X26=3GMvO*) zY13CiU-bPbMu_ud0=1b>Mkgs_5$iYS@{;)~i9EmhLYVk$SksOKGlrcuK*oH2p$z~F2Pn$e;l zrlJ+9fNERwmZRIL%z^2gK#NhCwyx@S&J++A6toF!brn_}qm&xAZEa=Js5mifL0D>f zNJR&>3T)A@<@K^-Sf*SSNK7`6N=u1^icV}72pI*M$jYf5D!R}u5HYo7U7*90bwikO zY{M+3rM;ahcA-Z=F)GKG%g%}$&IP%$Tg9X3qkP44s!JxqI8V2=;xUDW_(7)B&GB=yFrLG+3eKyzfH{Hf8({QwlMc&TS>VZr z@YS^i({{ga&3K-L#gh3fE-KJe%p=ceHkiv;q;1}@Y;s6hwAdodqQIdb3o{FvJ)>W) z>SkU~H?UY&;RdIxxCE+D@}6da{lOS~FV|!mmZMSQcpyC;>~Mz_l-Oo!OmWMI?P|s- znwnF!S@wq;wVcs<;jQOZy-?F*X~~Ohp!%2z*>whIStl8*K;`X|hN+*bF3;=sS#7@L zb}1{bm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M9()!xF)4e)C@z}PILq| zXDNd`YgOoA&P8FJqrC+qW6{MPod2Hydp6MicY2c@Jh7eh7V$=eE>h~+7-DyBGaX1{ z2YCU5Oi8D9j#76|x>FC4tGdO9=qE=zs;)x`%&`&&L!#}T$%u$BT*RAn9p~>7H3M(a zUZ?gpb-p`l+Rbh5w440YBMfaJFYp+Xz!s(rWM>~?ehXy-KVhL-3^P~?3);sq1CEfd z%&9qw9ADEYj&($m--#q2MKVfHm!sj~CxJWd|7UV&uCiKBA8+fq8RsklC*W|9ducO7 zk7Hz>AmcR8W_fp*^P?wqj@U6y=Q8uvQ(V9bHT^&i;T>waM&+GI%26b`(LIPgWmlde rC5E3M#y<-*`%i^TT%nDDckv#jp5FJ#x{5k{e8>}rC%4hWN9g|>y$q_; diff --git a/out/production/RobotAbgabe/roboter/RobotInstructions.class b/out/production/RobotAbgabe/roboter/RobotInstructions.class index 9963796f43d63305faf67a33155655837e5ca0a8..59837e5d001a0d54e183f9709b3ae973651c17e1 100644 GIT binary patch delta 100 zcmZo=+Qr0m>ff$?3=9mm3<49mx-{4sxEUF=i}I85OHzyUQ!A2F3raHc^NRI@KtjHW t>6yu4i8-aI6T2f-*%+7@I2gEC7#VmNco`TO*n!4C#eh6MAdiWG9{{XX75e}H delta 55 zcmdnR)XKzl>ff$?3=9mm415#0x+WeCP-J0XWZ+<7WZ+`p2C~?Ja$pf4n+M2dV&DY; DV?_uZ diff --git a/out/production/RobotAbgabe/roboter/exceptions/RobotMagicValueException.class b/out/production/RobotAbgabe/roboter/exceptions/RobotMagicValueException.class index 7e465aaf46dc2153c82e41503e8920d66f8fe925..22b789ffd52d58961e6ef59efa403b03ef31032d 100644 GIT binary patch delta 296 zcmX@l^qD#0)W2Q(7#J9A86>$Gm>8JZ8CZB2SQ*$D8F-8Glk!Vai}Zs)G$R9hdTNPZ zVs0uUgNTNvPgY`CqJBEUuHUSR^#+*;Z@85kKEwllDA1ag@e1c4+MSPJM=pjIIuUksv@ XL6|`V$OCF(5Cw{X3={|Qm>47gky$#6 delta 156 zcmey&e4feX)W2Q(7#J9A83ec(m>8JZ8CZB2SQ*$D83eKt%M$f-67$ma{gbj%lS>#G z*laTMGE3|j8JIOR!`K-(CeAgO_$YO9BBNdaJ5VzSFajY^JCNiA^7O%c1_oBG?F@_? jfdWhnTtE^e&A`CSzzrmMz-(3^%?so)GVlROCI)^0PD&NI diff --git a/out/test/RobotAbgabe/roboter/ExceptionTest.class b/out/test/RobotAbgabe/roboter/ExceptionTest.class index 66b0e279d432a02f888d21dfcd184d72a624fb30..8051207b746087a93ab249f3655d1fbcf0923e7c 100644 GIT binary patch literal 3086 zcmb7GZC4XV6n+K*3tSLzqkLS zAL<8-9#4NjPk&QSpV>`z6A%x6$n4y?Gta&Ex%bZGpZ}i!4d4oXkE0It3Suf6&?wNp zsI6)lQ?rVh{OqD$@B|t!8WKPtI{0xd<| z8?jtZvkJOEB9+e7?#L?GA#l2~s6Q&`E1qFnZf0B}jhLoh)XWJ_^Yoh)U4ovrtJsMI zeQ-*az=hOC*mTZzikZa{Jl-Pog`L&aWnGT7+M zHP_W02CHiR#6Rf@jHYrCAwwpW*=-q0R~_@QeDev=W;6DqTfqSp2XTmmRj8PJydn@A zI(s)S&>Duv)oc@vFz~tgVjRbiRB&9y37izzT{-GgH>?#r+j%U|#1!}|0{szB5~#|l z3C|%h*(g2!iEInf=uyzC;*_k0)*1`UCr=fNx^vfF)18Sm!z(N#SU-I-IT?Y$$Xo!o zy{t$^&ZroWbi~F7ZVV()kG=$Aa%e!Gthoy+F5(S=X2bQ3=UD};#~G>XiQ_V^D7dQP zO}r(rGfLTY+ctHLdzDqqEa~}qfsWKnb#}@-{L;9tVhA_FBDndmq?s&&lhs8KbVW6l z<(2f5ByU*7E!-Ap@D>bfiOrL`Ka##bB2{-(yp0@H?uxEa)ge`zQz9c8mctzdcLnxT zQV_Por0%j%V?*{FJFG2dSo&CLc~*BOWsNaMIlG{lQ<`H)xx5&oJB(y+SXVV@S>kv^ z4Vri&aIe8P%z_Qi1Zr;XVncbxvOZLNELgHjU^GvvzDmS^X*WDQdCyu4vHfTgDd;$d{If;oX*Q9*>wxE1EP ztrTasQqb+rvU`#DeyGVav>iEE=1+RK)q#FGKVg@gfvC#We?c>FCw1vVCP>^3`Xno2QICq?zV~;py3SG?JCIIP!R;Vi5+V zkEQg9iUnW#OiG`tC_jN(H3h#49DMawHbOu#j?iKqpFJSXH-j%T$9E`Y_!ay%^!x?!Cnt3n=P1>Hf(edl zumO{Jmy*B~wRQgC2mDIV1M5(7iPqldXam-<>z+UF3g!{0ynv_9hm`35=y zkg|aox^NHg(aDL*w@_F0O zkRl(tLjpU?1U8f4i}nieHzZb2xni1v+p?jkr?t~`3b+^H+20E DVR5$4 delta 753 zcmZWnOHWfl6#nKu+sQ~#lD;TN!DXbsjw&&G`WX(Z)qbE)eF$2@M@SP)o5_5BYs!ivir zV^|TG#Z=6~9aXIgT)`BBs5F~SYx>C}&vOW;#*mX$Dw`O zV1hirqBu^~D6LHG4u1sOp+rN8qG|&+&QcWN0M228Du(ma)i5r9*+o{8*+}A*nu-VT zeeEd&DNN!5O_!;s&@KjNFNJ3*e@yc_t(jfe^CKUSE>q~IDys@wc5$quCr*+Thk*p5 zNa6tD_aYtW8z_Z9|EZI0>L_~XDO@I^JtDffy1T%@Z$4NaS?!SUz(S1RyZ0CmjR4am zz#t=634#8_KLmGlAA$%3cCKz80_nX*Xd32F32bS&PJ2tZMPHcRrtB{DI5FNs9S@ND E3m=kd9{>OV diff --git a/out/test/RobotAbgabe/roboter/R2D2Test.class b/out/test/RobotAbgabe/roboter/R2D2Test.class index aa9925730bd3b943c40e8790e69f483595f745f3..3a51ee954410abbb4a3b9526337131e4b639351c 100644 GIT binary patch delta 126 zcmaFIv5=GN)W2Q(7#J9A8EiIkO<>YsXE0@C&@ReP$}dSR(od~OPAw?O%+D*<4+07K zCZ=a5hb88ercR#7^o~(raszWCuPB2OgBXK0gCv7FgVba`7F$&|1||k01``G|puubm Sj6iV)poj&Sv}CXX)7AhTvK&GH delta 83 zcmZ3;`Hq9@)W2Q(7#J9A8LT#PO<-c}4uAjv diff --git a/src/main/java/roboter/C3PO.java b/src/main/java/roboter/C3PO.java index 8927458..a69f38e 100644 --- a/src/main/java/roboter/C3PO.java +++ b/src/main/java/roboter/C3PO.java @@ -1,19 +1,25 @@ package roboter; import roboter.exceptions.RobotException; +import roboter.exceptions.RobotIllegalStateException; +import roboter.exceptions.RobotMagicValueException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; public class C3PO implements Robot { private int id; private String name; - private boolean isPowerOn=false; + private boolean isPowerOn = true; + ArrayList exceptionList=new ArrayList<>(); -public C3PO(int id, String name){ - this.id=id; - this.name=name; -} + public C3PO(int id, String name) { + this.id = id; + this.name = name; + } @Override public int getId() { @@ -27,11 +33,11 @@ public C3PO(int id, String name){ @Override public void triggerPowerSwitch() { - if(isPowerOn==false){ - isPowerOn=true; - }else{ - isPowerOn=false; - } + if (isPowerOn == false) { + isPowerOn = true; + } else { + isPowerOn = false; + } } //tes test @@ -42,31 +48,56 @@ public C3PO(int id, String name){ @Override public RobotException getLastException() { + if (!exceptionList.isEmpty()){ + return exceptionList.get(exceptionList.size() - 1); + + } return null; } @Override - public String speak(int[] zahlen) throws RobotException { - + public String speak(int[] zahlen) throws RobotException, RobotMagicValueException { + if(!isPowerOn){ + var ex=new RobotIllegalStateException(this); + exceptionList.add(ex); + throw ex; + } + if (Arrays.stream(zahlen).anyMatch(value -> value ==42)){ + var exc= new RobotMagicValueException(this); + exceptionList.add(exc); + throw exc; + } var sortiert = think(zahlen); return arrayFormatieren(sortiert); } - private String arrayFormatieren(int[] zahlen){ + private String arrayFormatieren(int[] zahlen) throws RobotMagicValueException { + var ergebnis = Arrays.stream(zahlen) .boxed() .map(String::valueOf) .collect(Collectors.joining(";")); return ergebnis; } + @Override public int[] think(int[] zahlen) throws RobotException { + if(!isPowerOn){ + var ex=new RobotIllegalStateException(this); + exceptionList.add(ex); + throw ex; + } + if (Arrays.stream(zahlen).anyMatch(value -> value ==42)){ + var exc= new RobotMagicValueException(this); + exceptionList.add(exc); + throw exc; + } int n = zahlen.length; for (int i = 1; i < n; ++i) { int key = zahlen[i]; int j = i - 1; - while (j >= 0 && zahlen[j] < key) { + while (j >= 0 && zahlen[j] > key) { zahlen[j + 1] = zahlen[j]; j = j - 1; } diff --git a/src/main/java/roboter/Nexus6.java b/src/main/java/roboter/Nexus6.java index 06cff81..516f6f6 100644 --- a/src/main/java/roboter/Nexus6.java +++ b/src/main/java/roboter/Nexus6.java @@ -49,8 +49,12 @@ public class Nexus6 implements Robot { } @Override - public RobotException getLastException() { - return exceptionList.get(exceptionList.size()-1); + public RobotException getLastException() { + if (!exceptionList.isEmpty()){ + return exceptionList.get(exceptionList.size() - 1); + + } + return null; } @Override diff --git a/src/main/java/roboter/R2D2.java b/src/main/java/roboter/R2D2.java index 41de9f8..75aba33 100644 --- a/src/main/java/roboter/R2D2.java +++ b/src/main/java/roboter/R2D2.java @@ -1,14 +1,18 @@ package roboter; import roboter.exceptions.RobotException; +import roboter.exceptions.RobotIllegalStateException; +import roboter.exceptions.RobotMagicValueException; +import java.util.ArrayList; import java.util.Arrays; import java.util.stream.Collectors; public class R2D2 implements Robot { private int id; private String name; - private boolean isPowerOn; + private boolean isPowerOn=true; + ArrayList exceptionList=new ArrayList<>(); public R2D2(int id, String name){ this.id=id; @@ -43,12 +47,25 @@ public class R2D2 implements Robot { @Override public RobotException getLastException() { + if (!exceptionList.isEmpty()){ + return exceptionList.get(exceptionList.size() - 1); + + } return null; } @Override - public String speak(int[] zahlen) throws RobotException { - + public String speak(int[] zahlen) throws RobotException, RobotMagicValueException { + if(!isPowerOn){ + var ex=new RobotIllegalStateException(this); + exceptionList.add(ex); + throw ex; + } + if (Arrays.stream(zahlen).anyMatch(value -> value ==42)){ + var exc= new RobotMagicValueException(this); + exceptionList.add(exc); + throw exc; + } var sortiert = think(zahlen); return arrayFormatieren(sortiert); @@ -62,7 +79,17 @@ public class R2D2 implements Robot { return ergebnis; } @Override - public int[] think(int[] zahlen) throws RobotException { + public int[] think(int[] zahlen) throws RobotException, RobotMagicValueException { + if(!isPowerOn){ + var ex=new RobotIllegalStateException(this); + exceptionList.add(ex); + throw ex; + } + if (Arrays.stream(zahlen).anyMatch(value -> value ==42)){ + var exc= new RobotMagicValueException(this); + exceptionList.add(exc); + throw exc; + } for (int i = 0; i < zahlen.length - 1; i++) { for (int j = i + 1; j < zahlen.length; j++) { if (zahlen[i] > zahlen[j]) { diff --git a/src/main/java/roboter/RobotInstructions.java b/src/main/java/roboter/RobotInstructions.java index 374bec5..c88e436 100644 --- a/src/main/java/roboter/RobotInstructions.java +++ b/src/main/java/roboter/RobotInstructions.java @@ -35,7 +35,7 @@ public interface RobotInstructions { * @throws RobotException wenn der Roboter in einem ungültigen Zustand ist, * oder das Array nicht seinen Vorstellungen entspricht. */ - public String speak(int[] zahlen) throws RobotException; + public String speak(int[] zahlen) throws RobotException, RobotMagicValueException; /** * Sortiert ein Array von Zahlen. Die Reihenfolge hängt von dem Typ des @@ -46,5 +46,5 @@ public interface RobotInstructions { * @throws RobotException wenn der Roboter in einem ungültigen Zustand ist, * oder das Array nicht seinen Vorstellungen entspricht. */ - public int[] think(int[] zahlen) throws RobotException; + public int[] think(int[] zahlen) throws RobotException, RobotMagicValueException; } \ No newline at end of file diff --git a/src/main/java/roboter/exceptions/RobotMagicValueException.java b/src/main/java/roboter/exceptions/RobotMagicValueException.java index 6c47b7a..d7e1a83 100644 --- a/src/main/java/roboter/exceptions/RobotMagicValueException.java +++ b/src/main/java/roboter/exceptions/RobotMagicValueException.java @@ -1,4 +1,9 @@ package roboter.exceptions; -public class RobotMagicValueException { +import roboter.Robot; + +public class RobotMagicValueException extends RobotException { + public RobotMagicValueException(Robot robot) { + super(robot.getName()); + } } diff --git a/src/test/java/roboter/C3PoSortierungTest.java b/src/test/java/roboter/C3PoSortierungTest.java new file mode 100644 index 0000000..2f70dc1 --- /dev/null +++ b/src/test/java/roboter/C3PoSortierungTest.java @@ -0,0 +1,20 @@ +package roboter; + +import org.junit.Assert; +import org.junit.Test; +import roboter.exceptions.RobotException; + +public class C3PoSortierungTest { + + @Test + public void sortieren() throws RobotException { + var list = new int[]{12,6,7,10,18,2}; + Robot robot= RobotFactory.getRobot(Typ.C3PO,"roboter2"); + + + assert robot != null; + Assert.assertEquals("2;6;7;10;12;18",robot.speak(list)); + } + + +} diff --git a/src/test/java/roboter/ExceptionTest.java b/src/test/java/roboter/ExceptionTest.java index 4c1a8de..0fe258b 100644 --- a/src/test/java/roboter/ExceptionTest.java +++ b/src/test/java/roboter/ExceptionTest.java @@ -17,6 +17,31 @@ public class ExceptionTest { } + @Test + public void powerOffSpeak(){ + Robot robot=RobotFactory.getRobot(Typ.C3PO,"dfg"); + robot.triggerPowerSwitch(); + + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot.speak(new int[8]); + }); + Robot robot2=RobotFactory.getRobot(Typ.R2D2,"dfg"); + robot2.triggerPowerSwitch(); + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot2.speak(new int[8]); + }); + + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot.think(new int[8]); + }); + + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot2.think(new int[8]); + }); + } + + + @Test public void testNexus6Trigger(){ Nexus6 robot = Nexus6.getInstance(); diff --git a/src/test/java/roboter/GetLastExceptionTest.java b/src/test/java/roboter/GetLastExceptionTest.java new file mode 100644 index 0000000..141c74c --- /dev/null +++ b/src/test/java/roboter/GetLastExceptionTest.java @@ -0,0 +1,44 @@ +package roboter; + +import org.junit.Assert; +import org.junit.Test; +import roboter.exceptions.RobotIllegalStateException; +import roboter.exceptions.RobotMagicValueException; + +import java.util.ArrayList; + +public class GetLastExceptionTest { + @Test + public void testGetLastExcetion(){ + int[]zahlen=new int[]{1,3,5,42}; + Robot robot= RobotFactory.getRobot(Typ.C3PO,"ukzfiouz"); + Assert.assertThrows(RobotMagicValueException.class,()->{ + robot.speak(zahlen); + }); + Assert.assertThrows(RobotMagicValueException.class,()->{ + robot.think(zahlen); + }); + Assert.assertTrue(robot.getLastException() instanceof RobotMagicValueException); + + Robot robot1= RobotFactory.getRobot(Typ.R2D2,"ukzfiouz"); + Assert.assertThrows(RobotMagicValueException.class,()->{ + robot1.speak(zahlen); + }); + Assert.assertThrows(RobotMagicValueException.class,()->{ + robot1.think(zahlen); + }); + Assert.assertTrue(robot1.getLastException() instanceof RobotMagicValueException); + + Robot robot2= RobotFactory.getRobot(Typ.Nexus6,"ukzfiouz"); + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot2.speak(zahlen); + }); + Assert.assertThrows(RobotIllegalStateException.class,()->{ + robot2.think(zahlen); + }); + Assert.assertTrue(robot2.getLastException() instanceof RobotIllegalStateException); + } + + + +} diff --git a/src/test/java/roboter/R2D2Test.java b/src/test/java/roboter/R2D2Test.java index 12338e9..124ff4b 100644 --- a/src/test/java/roboter/R2D2Test.java +++ b/src/test/java/roboter/R2D2Test.java @@ -4,6 +4,7 @@ import org.junit.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DynamicNode; import roboter.exceptions.RobotException; +import roboter.exceptions.RobotMagicValueException; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -14,26 +15,9 @@ import java.util.Properties; public class R2D2Test { - 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 { + public void sortieren() throws RobotException, RobotMagicValueException { var list = new int[]{12,6,7,10,18,2}; Robot robot= RobotFactory.getRobot(Typ.R2D2,"roboter2"); From f36998631b2766ee9f1478acd7738779c710c4ca Mon Sep 17 00:00:00 2001 From: azadehobenland Date: Mon, 9 Jan 2023 23:32:50 +0100 Subject: [PATCH 13/13] -implemented getLastException Method for all classes - implemented RobotMagicValueException for speak and think - implemented RobotIllegalStateException for the number 42 - implemented tests for the above 3 points --- .../roboter/GetLastExceptionTest.class | Bin 0 -> 2817 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 out/test/RobotAbgabe/roboter/GetLastExceptionTest.class diff --git a/out/test/RobotAbgabe/roboter/GetLastExceptionTest.class b/out/test/RobotAbgabe/roboter/GetLastExceptionTest.class new file mode 100644 index 0000000000000000000000000000000000000000..2fe3bd48e576046a0a23f64e10942ae08a4f31da GIT binary patch literal 2817 zcma)8TT>KQ5dLNvc3>F=S1_z1@dCPlxQfIWS4|La#D!HL7$mo0IV=Oi44I1;5`RD{ zZ+XifNS@w#U7kcGt!*Llhs<^$U{RxMG?U;xK84C;6vCrD;9 zX3Fz~OEPsM6v9YP!E8R((6mKkabJl>Vqqaxm_7>y{arYXAq~Si&fqMEQD-9Tgf)@c zlHvJ{_7x20n;gE)SHmsrZA8Z?#uQ{~UATeZ)bo#{y%^VVUM__?KXGd!%f0H)q7D6W zWhQi7lBV>Wcouk+kWVoi(YadnC!jTR(_Av>RH6Qi~9<#|+Vh6j%h9xMZR%TdySeQ&*uW()- z5JsoN4;Smggn}H`&o{TllIfYOX3Dl5GACD_(~fPE?1=yama)CMW(*}%F~q6#ChYza zC*D{DPs1XcXr9By{bOuYhHI6UuEz$zR_UlSVcv_sb=@4{lwW4g;Gc=BaHR>CDyea*Zzs0 z^jc7q;GSWxS;8ACInGwFQ+#(-V_)_J^3D};_x&5Al&xdqXQqZcZCKWV>5F0y(qv^l zgHKS^v5be*OsQ?^_&n4sscq|c6l#vtc62O-nkzL=$7i7yNbQM^2YATqamKcV8(xHh zi^e|%!|za?#F~chc=B4i^2kIK<0Lbtcq+c3iws~BeUG5mY3CZdAYr#yqxYCEtg(G%N}@z?%8bL zxv@8R4|s)Rk0Rw{q?~(=Qwsh<-z(%_;#}xHm+c#;d!g5ZxF<7FVdt@Pgd^h#~xp zv-k!1kdn!$?HVP0_zCwgLuv-`13txl(lbkp5~ViAk5ao&s^*we5?cm(GIID4jhNzF z&Zcv8>@}{W@Tgg+{8t4S=FrZBiH}5%As`LttRHt+zLo%diomD$ z4a`+e0#2%UfWXK10829DPg2D^F-gEl73T