45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
import de.hsmannheim.informatik.name.domain.exceptions.RobotException;
|
|
import de.hsmannheim.informatik.name.domain.exceptions.RobotIllegalStateException;
|
|
import de.hsmannheim.informatik.name.domain.exceptions.RobotMagicValueException;
|
|
import de.hsmannheim.informatik.name.domain.starwars.R2D2;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class R2D2ThinkTest {
|
|
|
|
private final R2D2 r2d2 = new R2D2(9999);
|
|
|
|
R2D2ThinkTest() throws RobotIllegalStateException {
|
|
}
|
|
|
|
@Test
|
|
void thinkTestStandard() throws RobotException, RobotMagicValueException {
|
|
|
|
assertArrayEquals(new int[]{0,1,2,3,4,5}, r2d2.think(new int[]{3,0,1,5,2,4}));
|
|
}
|
|
|
|
@Test
|
|
void thinkTestNegative() throws RobotException, RobotMagicValueException {
|
|
assertArrayEquals(new int[]{-3,-2,-1,0,1,2,3}, r2d2.think(new int[]{0,-3,2,-1,1,3,-2}));
|
|
}
|
|
|
|
@Test
|
|
void thinkTestZeros() throws RobotException, RobotMagicValueException {
|
|
assertArrayEquals(new int[]{0,0,0,0}, r2d2.think(new int[]{0,0,0,0}));
|
|
}
|
|
|
|
@Test
|
|
void thinkTestEmpty() throws RobotException, RobotMagicValueException {
|
|
assertArrayEquals(new int[]{}, r2d2.think(new int[]{}));
|
|
}
|
|
|
|
@Test
|
|
void thinkTestMagicNumberException() {
|
|
assertThrows(RobotMagicValueException.class,() -> r2d2.think(new int[]{42}));
|
|
}
|
|
|
|
|
|
|
|
}
|