RobotFactory/tests/R2D2IDTest.java

29 lines
970 B
Java
Raw Normal View History

2022-12-23 13:37:38 +01:00
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));
}
}