diff --git a/bin/C3PO.class b/bin/C3PO.class deleted file mode 100644 index cfa7783..0000000 Binary files a/bin/C3PO.class and /dev/null differ diff --git a/bin/Nexus6.class b/bin/Nexus6.class deleted file mode 100644 index d56ae45..0000000 Binary files a/bin/Nexus6.class and /dev/null differ diff --git a/bin/R2D2.class b/bin/R2D2.class deleted file mode 100644 index 99b8a32..0000000 Binary files a/bin/R2D2.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/Robot.class b/bin/tpe/exceptions/roboter/Robot.class deleted file mode 100644 index a728b70..0000000 Binary files a/bin/tpe/exceptions/roboter/Robot.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/RobotControl.class b/bin/tpe/exceptions/roboter/RobotControl.class deleted file mode 100644 index 270ad94..0000000 Binary files a/bin/tpe/exceptions/roboter/RobotControl.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/RobotInstructions.class b/bin/tpe/exceptions/roboter/RobotInstructions.class deleted file mode 100644 index 17111db..0000000 Binary files a/bin/tpe/exceptions/roboter/RobotInstructions.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/exceptions/RobotException.class b/bin/tpe/exceptions/roboter/exceptions/RobotException.class deleted file mode 100644 index c885bb9..0000000 Binary files a/bin/tpe/exceptions/roboter/exceptions/RobotException.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class b/bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class deleted file mode 100644 index b9a61a1..0000000 Binary files a/bin/tpe/exceptions/roboter/exceptions/RobotIllegalStateException.class and /dev/null differ diff --git a/bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class b/bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class deleted file mode 100644 index 36198c6..0000000 Binary files a/bin/tpe/exceptions/roboter/exceptions/RobotMagicValueException.class and /dev/null differ diff --git a/src/test/java/roboter/C3POTest.java b/src/test/java/roboter/C3POTest.java new file mode 100644 index 0000000..67e6a6d --- /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,"roboter2"); + + 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)); + } +} diff --git a/src/test/java/roboter/R2D2Test.java b/src/test/java/roboter/R2D2Test.java index 124ff4b..402aebd 100644 --- a/src/test/java/roboter/R2D2Test.java +++ b/src/test/java/roboter/R2D2Test.java @@ -19,10 +19,39 @@ public class R2D2Test { @Test public void sortieren() throws RobotException, RobotMagicValueException { 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)); + + 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)); } }