RobotFactory/tests/R2D2SpeakTest.java

36 lines
1001 B
Java
Raw Normal View History

2022-12-20 14:24:11 +01:00
import de.hsmannheim.informatik.name.domain.exceptions.RobotException;
import de.hsmannheim.informatik.name.domain.starwars.R2D2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class R2D2SpeakTest {
private final R2D2 r2d2 = new R2D2();
@Test
void speakTestStandard() 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}));
}
@Test
void speakTestEmpty() throws RobotException {
assertEquals("", r2d2.speak(new int[]{}));
}
@Test
void speakTestZeros() throws RobotException {
assertEquals("0, 0, 0, 0", r2d2.speak(new int[4]));
}
@Test
void speakTestOneElement() throws RobotException {
assertEquals("1", r2d2.speak(new int[]{1}));
}
@Test
void speakTestUnitElements() throws RobotException {
assertEquals("-1, 0, 1", r2d2.speak(new int[]{-1, 0, 1}));
}
}