the ci has always had a 'mvn test' step, but there was nothing to test. add junit 6 and pin surefire 3.6.0, extract the os detection into a testable fromOsName method, and cover the movement step math - including the axis-aligned cases that used to produce infinite steps and never converge.
34 lines
959 B
Java
34 lines
959 B
Java
package wtf.beatrice.autosqueal.util;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
class SystemUtilTest
|
|
{
|
|
@Test
|
|
void detectsWindows() {
|
|
assertEquals(SystemUtil.OperatingSystem.WINDOWS, SystemUtil.fromOsName("Windows 11"));
|
|
}
|
|
|
|
@Test
|
|
void detectsLinux() {
|
|
assertEquals(SystemUtil.OperatingSystem.LINUX, SystemUtil.fromOsName("Linux"));
|
|
assertEquals(SystemUtil.OperatingSystem.LINUX, SystemUtil.fromOsName("GNU/Linux"));
|
|
}
|
|
|
|
@Test
|
|
void detectsMacOS() {
|
|
assertEquals(SystemUtil.OperatingSystem.MAC_OS, SystemUtil.fromOsName("Mac OS X"));
|
|
}
|
|
|
|
@Test
|
|
void unknownForOtherSystems() {
|
|
assertEquals(SystemUtil.OperatingSystem.UNKNOWN, SystemUtil.fromOsName("SunOS"));
|
|
}
|
|
|
|
@Test
|
|
void hostSystemMatchesOsName() {
|
|
assertEquals(SystemUtil.fromOsName(System.getProperty("os.name")), SystemUtil.getHostSystem());
|
|
}
|
|
} |