staging exceptions and interfaces for merge
parent
d4362b1cf4
commit
2ec4b24942
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package robot.exceptions;
|
||||
|
||||
public class RobotMagicValueException extends Exception{
|
||||
public class RobotMagicValueException extends RobotException{
|
||||
public RobotMagicValueException(String errormessage){
|
||||
super(errormessage);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
|
@ -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 <code>null</code> falls noch
|
||||
* keine aufgetreten ist.
|
||||
*/
|
||||
//public RobotException getLastException();
|
||||
public RobotException getLastException();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
|
@ -2,5 +2,6 @@ package robot.interfaces;
|
|||
|
||||
@FunctionalInterface
|
||||
public interface Sorting {
|
||||
String sorting (int[] input);
|
||||
int[] sorting(int[] input);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue