diff --git a/domain/R2D2Test.java b/domain/R2D2Test.java index 3b1c87c..d7e3136 100644 --- a/domain/R2D2Test.java +++ b/domain/R2D2Test.java @@ -1,45 +1,4 @@ -package domain; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.*; - - class R2D2Test { - - R2D2 Herbert; - int id = 0; - String name = "Herbert"; - @BeforeEach - void setup(){ - Herbert = new R2D2(id, name); - } - - - //Tests for basic functions - @Test - void getId() { - assertEquals(id, Herbert.getId()); - } - - @Test - void getName() { - assertEquals(name, Herbert.getName()); - } - - @Test - void triggerPowerSwitch() { - Herbert.triggerPowerSwitch(); - assertTrue(Herbert.isPowerOn()); - } - - @Test - void isPowerOn() { - assertFalse(Herbert.isPowerOn()); - Herbert.triggerPowerSwitch(); - assertTrue(Herbert.isPowerOn()); - } - - + } \ No newline at end of file diff --git a/robot/exceptions/RobotMagicValueException.java b/robot/exceptions/RobotMagicValueException.java index d0bf6a5..b4c8a96 100644 --- a/robot/exceptions/RobotMagicValueException.java +++ b/robot/exceptions/RobotMagicValueException.java @@ -1,6 +1,6 @@ package robot.exceptions; -public class RobotMagicValueException extends Exception{ +public class RobotMagicValueException extends RobotException{ public RobotMagicValueException(String errormessage){ super(errormessage); } diff --git a/robot/interfaces/Robot.java b/robot/interfaces/Robot.java index 105b9a9..c7bdf19 100644 --- a/robot/interfaces/Robot.java +++ b/robot/interfaces/Robot.java @@ -1,12 +1,17 @@ /* (c) 2012 Thomas Smits */ -//package tpe.exceptions.roboter; package robot.interfaces; + +import robot.exceptions.RobotException; + /** * Interface für Roboter. * * @author Thomas Smits */ -public interface Robot extends RobotControl, RobotInstructions { - // keine eigenen Methoden + + +public interface Robot extends RobotControl, RobotInstructions{ + // keine eigenen Methoden + } \ No newline at end of file diff --git a/robot/interfaces/RobotControl.java b/robot/interfaces/RobotControl.java index 0957a70..8fd6276 100644 --- a/robot/interfaces/RobotControl.java +++ b/robot/interfaces/RobotControl.java @@ -1,7 +1,5 @@ -//package tpe.exceptions.roboter; package robot.interfaces; - -//import tpe.exceptions.roboter.exceptions.RobotException; +import robot.exceptions.RobotException; /** * Das Interface repräsentiert einen einfachen Roboter mit seinen Funktionen. @@ -71,5 +69,5 @@ public interface RobotControl { * @return zuletzt aufgetretene Ausnahme oder null falls noch * keine aufgetreten ist. */ - //public RobotException getLastException(); + public RobotException getLastException(); } diff --git a/robot/interfaces/RobotInstructions.java b/robot/interfaces/RobotInstructions.java index 3fb364a..bb83a65 100644 --- a/robot/interfaces/RobotInstructions.java +++ b/robot/interfaces/RobotInstructions.java @@ -2,7 +2,7 @@ package robot.interfaces; import robot.exceptions.RobotException; import robot.exceptions.RobotIllegalStateException; -//import tpe.exceptions.roboter.exceptions.RobotMagicValueException; +import robot.exceptions.RobotMagicValueException; /** @@ -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, RobotIllegalStateException; + String speak(int[] zahlen) throws RobotException; /** * Sortiert ein Array von Zahlen. Die Reihenfolge hängt von dem Typ des @@ -46,5 +46,7 @@ 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; + int[] think(int[] zahlen) throws RobotException; + + } \ No newline at end of file diff --git a/robot/interfaces/Sorting.java b/robot/interfaces/Sorting.java index df891b4..7efee17 100644 --- a/robot/interfaces/Sorting.java +++ b/robot/interfaces/Sorting.java @@ -2,5 +2,6 @@ package robot.interfaces; @FunctionalInterface public interface Sorting { - String sorting (int[] input); + int[] sorting(int[] input); + }