diff --git a/.DS_Store b/.DS_Store index 4b5e2a6..46eb8a0 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.idea/misc.xml b/.idea/misc.xml index 2be7c15..d15472f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/out/production/Robot_Factory_PR/Main.class b/out/production/Robot_Factory_PR/Main.class index 2f9982d..17e140e 100644 Binary files a/out/production/Robot_Factory_PR/Main.class and b/out/production/Robot_Factory_PR/Main.class differ diff --git a/out/production/Robot_Factory_PR/classpath.index b/out/production/Robot_Factory_PR/classpath.index deleted file mode 100644 index 699ea37..0000000 Binary files a/out/production/Robot_Factory_PR/classpath.index and /dev/null differ diff --git a/out/production/Robot_Factory_PR/domain/C3PO.class b/out/production/Robot_Factory_PR/domain/C3PO.class index 3914b92..a2a3db4 100644 Binary files a/out/production/Robot_Factory_PR/domain/C3PO.class and b/out/production/Robot_Factory_PR/domain/C3PO.class differ diff --git a/out/production/Robot_Factory_PR/domain/Factory.class b/out/production/Robot_Factory_PR/domain/Factory.class index 55fb312..701cb9e 100644 Binary files a/out/production/Robot_Factory_PR/domain/Factory.class and b/out/production/Robot_Factory_PR/domain/Factory.class differ diff --git a/out/production/Robot_Factory_PR/domain/Nexus6.class b/out/production/Robot_Factory_PR/domain/Nexus6.class index 2b11119..fe779cf 100644 Binary files a/out/production/Robot_Factory_PR/domain/Nexus6.class and b/out/production/Robot_Factory_PR/domain/Nexus6.class differ diff --git a/out/production/Robot_Factory_PR/domain/R2D2.class b/out/production/Robot_Factory_PR/domain/R2D2.class index 8d66d79..3dc3d99 100644 Binary files a/out/production/Robot_Factory_PR/domain/R2D2.class and b/out/production/Robot_Factory_PR/domain/R2D2.class differ diff --git a/out/production/Robot_Factory_PR/domain/Robot.class b/out/production/Robot_Factory_PR/domain/Robot.class index 4a2269d..e5cea51 100644 Binary files a/out/production/Robot_Factory_PR/domain/Robot.class and b/out/production/Robot_Factory_PR/domain/Robot.class differ diff --git a/out/production/Robot_Factory_PR/domain/RobotType.class b/out/production/Robot_Factory_PR/domain/RobotType.class index 815b94b..14f9c68 100644 Binary files a/out/production/Robot_Factory_PR/domain/RobotType.class and b/out/production/Robot_Factory_PR/domain/RobotType.class differ diff --git a/out/production/Robot_Factory_PR/facade/FactorySystem.class b/out/production/Robot_Factory_PR/facade/FactorySystem.class index 568a01a..4839b5e 100644 Binary files a/out/production/Robot_Factory_PR/facade/FactorySystem.class and b/out/production/Robot_Factory_PR/facade/FactorySystem.class differ diff --git a/out/production/Robot_Factory_PR/infrastructure/Persistenz.class b/out/production/Robot_Factory_PR/infrastructure/Persistenz.class index 92e6b24..9c31bf5 100644 Binary files a/out/production/Robot_Factory_PR/infrastructure/Persistenz.class and b/out/production/Robot_Factory_PR/infrastructure/Persistenz.class differ diff --git a/out/production/Robot_Factory_PR/src/domain/C3PO.class b/out/production/Robot_Factory_PR/src/domain/C3PO.class deleted file mode 100644 index 372403a..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/C3PO.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/domain/Factory.class b/out/production/Robot_Factory_PR/src/domain/Factory.class deleted file mode 100644 index 29dd94c..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/Factory.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/domain/Nexus6.class b/out/production/Robot_Factory_PR/src/domain/Nexus6.class deleted file mode 100644 index eb22343..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/Nexus6.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/domain/R2D2.class b/out/production/Robot_Factory_PR/src/domain/R2D2.class deleted file mode 100644 index 99e5aab..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/R2D2.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/domain/Robot.class b/out/production/Robot_Factory_PR/src/domain/Robot.class deleted file mode 100644 index d139f8c..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/Robot.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/domain/RobotType.class b/out/production/Robot_Factory_PR/src/domain/RobotType.class deleted file mode 100644 index d534e96..0000000 Binary files a/out/production/Robot_Factory_PR/src/domain/RobotType.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/facade/FactorySystem.class b/out/production/Robot_Factory_PR/src/facade/FactorySystem.class deleted file mode 100644 index bd710b3..0000000 Binary files a/out/production/Robot_Factory_PR/src/facade/FactorySystem.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/ui/UI$1.class b/out/production/Robot_Factory_PR/src/ui/UI$1.class deleted file mode 100644 index 851bd42..0000000 Binary files a/out/production/Robot_Factory_PR/src/ui/UI$1.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/ui/UI.class b/out/production/Robot_Factory_PR/src/ui/UI.class deleted file mode 100644 index 685eb77..0000000 Binary files a/out/production/Robot_Factory_PR/src/ui/UI.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/interfaces/Robot.class b/out/production/Robot_Factory_PR/src/utility/interfaces/Robot.class deleted file mode 100644 index 39dc03c..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/interfaces/Robot.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/interfaces/RobotControl.class b/out/production/Robot_Factory_PR/src/utility/interfaces/RobotControl.class deleted file mode 100644 index 9366ea5..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/interfaces/RobotControl.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/interfaces/RobotInstructions.class b/out/production/Robot_Factory_PR/src/utility/interfaces/RobotInstructions.class deleted file mode 100644 index 1c6d5b6..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/interfaces/RobotInstructions.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ArrayEmptyException.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ArrayEmptyException.class deleted file mode 100644 index f6344c7..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ArrayEmptyException.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ExceptionStorage.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ExceptionStorage.class deleted file mode 100644 index 9379318..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/ExceptionStorage.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotException.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotException.class deleted file mode 100644 index 2137eda..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotException.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotIllegalStateException.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotIllegalStateException.class deleted file mode 100644 index 2bbc4b0..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotIllegalStateException.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotMagicValueException.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotMagicValueException.class deleted file mode 100644 index cbd844a..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/RobotMagicValueException.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/robotExceptions.class b/out/production/Robot_Factory_PR/src/utility/robot_exceptions/robotExceptions.class deleted file mode 100644 index 383554b..0000000 Binary files a/out/production/Robot_Factory_PR/src/utility/robot_exceptions/robotExceptions.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/tests/tests/C3POTest.class b/out/production/Robot_Factory_PR/tests/tests/C3POTest.class deleted file mode 100644 index 775977b..0000000 Binary files a/out/production/Robot_Factory_PR/tests/tests/C3POTest.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/tests/tests/FactoryTest.class b/out/production/Robot_Factory_PR/tests/tests/FactoryTest.class deleted file mode 100644 index eeca4bd..0000000 Binary files a/out/production/Robot_Factory_PR/tests/tests/FactoryTest.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/tests/tests/R2D2Test.class b/out/production/Robot_Factory_PR/tests/tests/R2D2Test.class deleted file mode 100644 index 6ffc274..0000000 Binary files a/out/production/Robot_Factory_PR/tests/tests/R2D2Test.class and /dev/null differ diff --git a/out/production/Robot_Factory_PR/ui/UI$1.class b/out/production/Robot_Factory_PR/ui/UI$1.class index b858c80..62d0274 100644 Binary files a/out/production/Robot_Factory_PR/ui/UI$1.class and b/out/production/Robot_Factory_PR/ui/UI$1.class differ diff --git a/out/production/Robot_Factory_PR/ui/UI.class b/out/production/Robot_Factory_PR/ui/UI.class index de5df6d..a8f2400 100644 Binary files a/out/production/Robot_Factory_PR/ui/UI.class and b/out/production/Robot_Factory_PR/ui/UI.class differ diff --git a/out/production/Robot_Factory_PR/utility/interfaces/Robot.class b/out/production/Robot_Factory_PR/utility/interfaces/Robot.class index 67fb5dc..c5ef463 100644 Binary files a/out/production/Robot_Factory_PR/utility/interfaces/Robot.class and b/out/production/Robot_Factory_PR/utility/interfaces/Robot.class differ diff --git a/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class b/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class index 86dccf8..6db39f0 100644 Binary files a/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class and b/out/production/Robot_Factory_PR/utility/interfaces/RobotControl.class differ diff --git a/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class b/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class index 9443f1e..7e1d54f 100644 Binary files a/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class and b/out/production/Robot_Factory_PR/utility/interfaces/RobotInstructions.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class index 56d740e..19a7b23 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/ArrayEmptyException.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class index 12d289c..a7ea4c9 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/ExceptionStorage.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class index fd4917c..20e8706 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotException.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class index a45a7dd..7899bed 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotIllegalStateException.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class index d463030..5002bf7 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/RobotMagicValueException.class differ diff --git a/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class b/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class index 9275771..400f2a5 100644 Binary files a/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class and b/out/production/Robot_Factory_PR/utility/robot_exceptions/robotExceptions.class differ diff --git a/out/test/Robot_Factory_PR/classpath.index b/out/test/Robot_Factory_PR/classpath.index new file mode 100644 index 0000000..9789a9f Binary files /dev/null and b/out/test/Robot_Factory_PR/classpath.index differ diff --git a/out/test/Robot_Factory_PR/tests/C3POTest.class b/out/test/Robot_Factory_PR/tests/C3POTest.class index a4992af..433be10 100644 Binary files a/out/test/Robot_Factory_PR/tests/C3POTest.class and b/out/test/Robot_Factory_PR/tests/C3POTest.class differ diff --git a/out/test/Robot_Factory_PR/tests/FactoryTest.class b/out/test/Robot_Factory_PR/tests/FactoryTest.class index 97d7fbb..4a90a53 100644 Binary files a/out/test/Robot_Factory_PR/tests/FactoryTest.class and b/out/test/Robot_Factory_PR/tests/FactoryTest.class differ diff --git a/out/test/Robot_Factory_PR/tests/Nexus6Test.class b/out/test/Robot_Factory_PR/tests/Nexus6Test.class index 1f773a9..637f79c 100644 Binary files a/out/test/Robot_Factory_PR/tests/Nexus6Test.class and b/out/test/Robot_Factory_PR/tests/Nexus6Test.class differ diff --git a/out/test/Robot_Factory_PR/tests/R2D2Test.class b/out/test/Robot_Factory_PR/tests/R2D2Test.class index 257975b..eb9b238 100644 Binary files a/out/test/Robot_Factory_PR/tests/R2D2Test.class and b/out/test/Robot_Factory_PR/tests/R2D2Test.class differ diff --git a/src/Main.java b/src/Main.java index 8d21aa5..6d2f062 100644 --- a/src/Main.java +++ b/src/Main.java @@ -7,5 +7,5 @@ public class Main { UI ui = new UI(fs); } - + } diff --git a/src/domain/C3PO.java b/src/domain/C3PO.java index 615371f..766f37f 100644 --- a/src/domain/C3PO.java +++ b/src/domain/C3PO.java @@ -7,7 +7,6 @@ import utility.robot_exceptions.robotExceptions; public class C3PO extends Robot { public C3PO(int id, String name){ super(id, name, RobotType.C3PO); - } /** * @param input from the user diff --git a/src/domain/Factory.java b/src/domain/Factory.java index ffd55ba..8ee51a4 100644 --- a/src/domain/Factory.java +++ b/src/domain/Factory.java @@ -41,7 +41,9 @@ public class Factory implements Serializable { r = new R2D2(r2d2ID++, name); } else if(type == RobotType.C3PO) { r = new C3PO(c3poID++, name); - } else { + }else if(type == RobotType.Nexus6){ + r = new Nexus6("Pris"); + }else { return false; } diff --git a/src/domain/Robot.java b/src/domain/Robot.java index 4c7e057..ba877e3 100644 --- a/src/domain/Robot.java +++ b/src/domain/Robot.java @@ -99,9 +99,11 @@ public abstract class Robot implements utility.interfaces.Robot, Serializable { */ public String output(int[] input, String delemiter)throws RobotException{ if(checkArray(input)) { - return Arrays.stream(input) - .mapToObj(Integer::toString) - .collect(Collectors.joining(delemiter + " ")); + final String[] msg = {""}; + Arrays.stream(input).forEach(s -> { + msg[0] += s + delemiter + " "; + }); + return msg[0]; }else{ RobotException robotexception = new RobotException(robotExceptions.MAGICVALUE, getName()); this.exceptions = new ExceptionStorage(robotexception); diff --git a/src/facade/FactorySystem.java b/src/facade/FactorySystem.java index 7cfefcb..ad71021 100644 --- a/src/facade/FactorySystem.java +++ b/src/facade/FactorySystem.java @@ -4,6 +4,7 @@ import domain.Factory; import domain.Robot; import domain.RobotType; import infrastructure.Persistenz; +import utility.robot_exceptions.RobotException; public class FactorySystem { private Factory factory; @@ -22,6 +23,7 @@ public class FactorySystem { } }else{ this.factory = new Factory(); + boolean pris = buildNewRobot("Pris", RobotType.Nexus6); } } @@ -36,11 +38,7 @@ public class FactorySystem { public boolean buildNewRobot(String name, RobotType type) { boolean check = factory.buildNewRobot(name, type); if(check) { - try { - Persistenz.saveFactoryData(factory, factoryName); - }catch(Exception e){ - System.out.println(e.getCause()); - } + saveFactroyData(); } return check; } @@ -53,4 +51,37 @@ public class FactorySystem { return factory.getRobotOfList(id); } + public String letRobotSpeak(int[] input, int id){ + + String output = ""; + try{ + output = factory.getRobotOfList(id).speak(input); + }catch(RobotException re){ + saveFactroyData(); + } + return output; + } + + public int[] letRobotThink(int[] input, int id){ + int[] unsorted = new int[input.length]; + try{ + unsorted = factory.getRobotOfList(id).think(input); + }catch(RobotException re){ + saveFactroyData(); + } + return unsorted; + } + + public RobotException getExceptions(int id){ + return factory.getRobotOfList(id).getLastException(); + } + + public void saveFactroyData(){ + try { + Persistenz.saveFactoryData(factory, factoryName); + }catch(Exception e){ + System.out.println(e.getCause()); + } + } + } diff --git a/src/ui/UI.java b/src/ui/UI.java index f819112..c618da9 100644 --- a/src/ui/UI.java +++ b/src/ui/UI.java @@ -125,43 +125,54 @@ public class UI { mainloop: while(true) { System.out.println(); - System.out.println("_______________________________"); - System.out.println("Sie haben folgende optionen: "); - System.out.println("-1- --- Roboter " + (!fs.searchForRobot(idInput).isPowerOn() ? "Einschalten " : "Ausschalten " ) + " ---"); - System.out.println("-2- -- Sortieren einer Liste --"); - System.out.println("-3- ----- Namen ausgeben ------"); - System.out.println("-4- ------ ID ausgeben --------"); - System.out.println("-5- ------ Typ ausgeben -------"); - System.out.println("-6- ---------- Exit -----------"); + System.out.println("____________________________________"); + System.out.println("--- Sie haben folgende optionen: ---"); + System.out.println("-1- ----- Roboter " + (!fs.searchForRobot(idInput).isPowerOn() ? "Einschalten " : "Ausschalten " ) + " -----"); + System.out.println("-2- ---- Sortieren einer Liste -----"); + System.out.println("-3- ------- Namen ausgeben ---------"); + System.out.println("-4- --------- ID ausgeben ----------"); + System.out.println("-5- -------- Typ ausgeben ----------"); + System.out.println("-6- - letzte Fehlermeldung anzeigen -"); + System.out.println("-7- ------------- Exit --------------"); System.out.print(" > "); //User options try { int input = Integer.parseInt(sc.nextLine()); switch (input) { - case 1: + case 1 -> { fs.searchForRobot(idInput).triggerPowerSwitch(); System.out.println("Der Roboter hat seinen Zustand gewechselt"); - break; - case 2: + } + case 2 -> { int[] unsortedList = null; - while(unsortedList == null) { + while (unsortedList == null) { try { - unsortedList = fs.searchForRobot(idInput).think(Arrays.stream(sc.nextLine().split(", ")).mapToInt(Integer::parseInt).toArray()); - System.out.println(fs.searchForRobot(idInput).speak(unsortedList)); - } catch (NumberFormatException | RobotException e) { - if(e.getClass() == RobotException.class){ - System.out.println(((RobotException) e).getMessage()); - break; - }else{ + unsortedList = fs.letRobotThink(Arrays.stream(sc.nextLine().split(", ")).mapToInt(Integer::parseInt).toArray(), idInput); + System.out.println(fs.letRobotSpeak(unsortedList, idInput)); + } catch (NumberFormatException nfe) { System.out.println("Falsches Format versuch es erneut"); - break; - } } } - break; - case 6: break mainloop; - default: - System.out.println("Keine valide Option"); break; + } + case 3 -> System.out.println("Mein Name lautet " + fs.searchForRobot(idInput).getName() + "."); + case 4 -> System.out.println("Meine ID ist " + fs.searchForRobot(idInput).getId() + "."); + case 5 -> System.out.println("Meine Typ ist " + fs.searchForRobot(idInput).getType().toString() + "."); + + case 6 -> { + try{ + String message = fs.getExceptions(idInput).getMessage(); + System.out.println("Letze Fehlermeldung: "); + System.out.println(message); + }catch(NullPointerException npe){ + System.out.println("Bisher keine Fehlermeldung vorhanden."); + } + } + case 7 -> { + break mainloop; + } + + default -> System.out.println("Keine valide Option"); + } }catch(NumberFormatException nfe) { System.out.println("Kein valider input"); diff --git a/src/utility/robot_exceptions/ExceptionStorage.java b/src/utility/robot_exceptions/ExceptionStorage.java index 31068bc..5f8506d 100644 --- a/src/utility/robot_exceptions/ExceptionStorage.java +++ b/src/utility/robot_exceptions/ExceptionStorage.java @@ -1,25 +1,12 @@ package utility.robot_exceptions; - import java.io.Serializable; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; public class ExceptionStorage implements Serializable { private RobotException message; - private LocalDateTime date; public ExceptionStorage(RobotException message){ this.message = message; - DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); - LocalDateTime now = LocalDateTime.now(); - this.date = now; - } - /** - * @param message of the exception - */ - public void saveLatestErrorMessage(RobotException message){ - this.message = message; - this.date = LocalDateTime.now(); + } public RobotException getLastErrorMessage(){ diff --git a/src/utility/robot_exceptions/RobotException.java b/src/utility/robot_exceptions/RobotException.java index 3e95aec..a1e04f5 100644 --- a/src/utility/robot_exceptions/RobotException.java +++ b/src/utility/robot_exceptions/RobotException.java @@ -1,5 +1,8 @@ package utility.robot_exceptions; +import facade.FactorySystem; +import infrastructure.Persistenz; + public class RobotException extends Exception{ robotExceptions currentType; String name; diff --git a/test_factoryFactory.ser b/test_factoryFactory.ser index f146119..3594def 100644 Binary files a/test_factoryFactory.ser and b/test_factoryFactory.ser differ diff --git a/tests/tests/C3POTest.java b/tests/tests/C3POTest.java index 28565aa..258eac5 100644 --- a/tests/tests/C3POTest.java +++ b/tests/tests/C3POTest.java @@ -40,7 +40,7 @@ class C3POTest { @Test void speak(){ - String solution = "12; 2; 4; 5; 12; 2; 4; 7; 56; 433; 23"; + String solution = "12; 2; 4; 5; 12; 2; 4; 7; 56; 433; 23; "; int[] input = {12, 2, 4, 5, 12, 2, 4, 7, 56, 433, 23}; String array = ""; try{ @@ -53,7 +53,7 @@ class C3POTest { @Test void C3POSpeakTestStandard() throws RobotException { - assertEquals("1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12", c3po.speak(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})); + assertEquals("1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; ", c3po.speak(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})); } @Test @@ -67,17 +67,17 @@ class C3POTest { @Test void C3POSpeakTestZeros() throws RobotException { - assertEquals("0; 0; 0; 0", c3po.speak(new int[4])); + assertEquals("0; 0; 0; 0; ", c3po.speak(new int[4])); } @Test void C3POSpeakTestOneElement() throws RobotException { - assertEquals("1", c3po.speak(new int[]{1})); + assertEquals("1; ", c3po.speak(new int[]{1})); } @Test void C3POSpeakTestUnitElements() throws RobotException { - assertEquals("-1; 0; 1", c3po.speak(new int[]{-1, 0, 1})); + assertEquals("-1; 0; 1; ", c3po.speak(new int[]{-1, 0, 1})); } @Test diff --git a/tests/tests/Nexus6Test.java b/tests/tests/Nexus6Test.java index 5874631..3d157ea 100644 --- a/tests/tests/Nexus6Test.java +++ b/tests/tests/Nexus6Test.java @@ -1,7 +1,6 @@ package tests; import domain.Nexus6; -import domain.R2D2; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import utility.robot_exceptions.RobotException; diff --git a/tests/tests/R2D2Test.java b/tests/tests/R2D2Test.java index ec50f7e..cd377aa 100644 --- a/tests/tests/R2D2Test.java +++ b/tests/tests/R2D2Test.java @@ -38,7 +38,7 @@ class R2D2Test { @Test void R2D2SpeakTestStandard() throws RobotException { - assertEquals("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12", r2d2.speak(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})); + assertEquals("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ", r2d2.speak(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})); } @Test @@ -52,17 +52,17 @@ class R2D2Test { @Test void R2D2SpeakTestZeros() throws RobotException { - assertEquals("0, 0, 0, 0", r2d2.speak(new int[4])); + assertEquals("0, 0, 0, 0, ", r2d2.speak(new int[4])); } @Test void R2D2SpeakTestOneElement() throws RobotException { - assertEquals("1", r2d2.speak(new int[]{1})); + assertEquals("1, ", r2d2.speak(new int[]{1})); } @Test void R2D2SpeakTestUnitElements() throws RobotException { - assertEquals("-1, 0, 1", r2d2.speak(new int[]{-1, 0, 1})); + assertEquals("-1, 0, 1, ", r2d2.speak(new int[]{-1, 0, 1})); } @Test @@ -76,7 +76,7 @@ class R2D2Test { @Test void speak(){ - String solution = "12, 2, 4, 5, 12, 2, 4, 7, 56, 433, 23"; + String solution = "12, 2, 4, 5, 12, 2, 4, 7, 56, 433, 23, "; int[] input = {12, 2, 4, 5, 12, 2, 4, 7, 56, 433, 23}; String array = ""; try{