added tests for c3po
parent
d28c82abdc
commit
b18663a28e
|
@ -11,6 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
class ThinkTest {
|
class ThinkTest {
|
||||||
|
|
||||||
private final R2D2 r2d2 = new R2D2(9999, "test");
|
private final R2D2 r2d2 = new R2D2(9999, "test");
|
||||||
|
private final C3PO c3po = new C3PO(19999, "test");
|
||||||
|
|
||||||
ThinkTest() throws RobotIllegalStateException {
|
ThinkTest() throws RobotIllegalStateException {
|
||||||
}
|
}
|
||||||
|
@ -40,6 +41,27 @@ class ThinkTest {
|
||||||
void thinkTestMagicNumberException() {
|
void thinkTestMagicNumberException() {
|
||||||
assertThrows(RobotMagicValueException.class, () -> r2d2.think(new int[]{42}));
|
assertThrows(RobotMagicValueException.class, () -> r2d2.think(new int[]{42}));
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
void thinkTestStandardC3PO() throws RobotException {
|
||||||
|
|
||||||
|
assertArrayEquals(new int[]{5, 4, 3, 2, 1, 0}, c3po.think(new int[]{3, 0, 1, 5, 2, 4}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void thinkTestNegativeC3PO() throws RobotException {
|
||||||
|
assertArrayEquals(new int[]{3, 2, 1, 0, -1, -2, -3}, c3po.think(new int[]{0, -3, 2, -1, 1, 3, -2}));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
void thinkTestZerosC3PO() throws RobotException {
|
||||||
|
assertArrayEquals(new int[]{0, 0, 0, 0}, c3po.think(new int[]{0, 0, 0, 0}));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
void thinkTestEmptyC3PO() throws RobotException {
|
||||||
|
assertArrayEquals(new int[]{}, c3po.think(new int[]{}));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
void thinkTestMagicNumberExceptionC3PO(){
|
||||||
|
assertThrows(RobotMagicValueException.class, () -> c3po.think(new int[]{42}));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue