View Javadoc
1   /*
2    * Copyright 2021-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.driver.linux;
6   
7   import static org.hamcrest.MatcherAssert.assertThat;
8   import static org.hamcrest.Matchers.containsString;
9   import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
10  
11  import org.junit.jupiter.api.Test;
12  import org.junit.jupiter.api.condition.EnabledOnOs;
13  import org.junit.jupiter.api.condition.OS;
14  
15  @EnabledOnOs(OS.LINUX)
16  class SysfsTest {
17  
18      @Test
19      void testQueries() {
20          assertDoesNotThrow(Sysfs::querySystemVendor);
21          assertDoesNotThrow(Sysfs::queryProductModel);
22          assertDoesNotThrow(Sysfs::queryProductSerial);
23          assertDoesNotThrow(Sysfs::queryUUID);
24          assertDoesNotThrow(Sysfs::queryBoardVendor);
25          assertDoesNotThrow(Sysfs::queryBoardModel);
26          assertDoesNotThrow(Sysfs::queryBoardVersion);
27          assertDoesNotThrow(Sysfs::queryBoardSerial);
28          assertDoesNotThrow(Sysfs::queryBiosVendor);
29          assertDoesNotThrow(Sysfs::queryBiosDescription);
30          assertDoesNotThrow(Sysfs::queryBiosReleaseDate);
31      }
32  
33      @Test
34      void testQueryBiosVersion() {
35          Sysfs.queryBiosVersion("");
36          final String biosRevisionSuffix = "biosRevision";
37          final String biosRevision = Sysfs.queryBiosVersion(biosRevisionSuffix);
38          if (biosRevision != null) {
39              assertThat("Test Sysfs queryBiosVersion with biosRevision", biosRevision,
40                      containsString(biosRevisionSuffix));
41          }
42      }
43  }