29 lines
970 B
Java
29 lines
970 B
Java
|
import de.hsmannheim.informatik.name.domain.exceptions.RobotIllegalStateException;
|
||
|
import de.hsmannheim.informatik.name.domain.starwars.R2D2;
|
||
|
import org.junit.jupiter.api.Test;
|
||
|
|
||
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||
|
|
||
|
public class R2D2IDTest {
|
||
|
|
||
|
@Test
|
||
|
public void NegativeTest(){
|
||
|
assertThrows(RobotIllegalStateException.class, () -> new R2D2(-1));
|
||
|
assertThrows(RobotIllegalStateException.class, () -> new R2D2(Integer.MIN_VALUE));
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
public void InIDRangeTest() {
|
||
|
assertDoesNotThrow(() -> new R2D2(0));
|
||
|
assertDoesNotThrow(() -> new R2D2(1));
|
||
|
assertDoesNotThrow(() -> new R2D2(9999));
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
public void OuterIDRangeTest() {
|
||
|
assertThrows(RobotIllegalStateException.class, () -> new R2D2(10000));
|
||
|
assertThrows(RobotIllegalStateException.class, () -> new R2D2(Integer.MAX_VALUE));
|
||
|
}
|
||
|
}
|