1
2
3
4
5 package oshi.driver.linux;
6
7 import static org.hamcrest.MatcherAssert.assertThat;
8 import static org.hamcrest.Matchers.anyOf;
9 import static org.hamcrest.Matchers.equalTo;
10 import static org.hamcrest.Matchers.greaterThan;
11 import static org.hamcrest.Matchers.matchesRegex;
12 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
13
14 import org.junit.jupiter.api.Test;
15 import org.junit.jupiter.api.condition.EnabledOnOs;
16 import org.junit.jupiter.api.condition.OS;
17
18 import oshi.TestConstants;
19
20 @EnabledOnOs(OS.LINUX)
21 class LshwTest {
22
23 @Test
24 void testQueries() {
25 assertDoesNotThrow(Lshw::queryModel);
26 assertDoesNotThrow(Lshw::querySerialNumber);
27 String uuid = Lshw.queryUUID();
28 if (uuid != null) {
29 assertThat("Test Lshw queryUUID", uuid, matchesRegex(TestConstants.UUID_REGEX));
30 }
31 assertThat("Test Lshw queryCpuCapacity", Lshw.queryCpuCapacity(), anyOf(greaterThan(0L), equalTo(-1L)));
32 }
33 }