1
2
3
4
5 package oshi.util;
6
7 import static org.hamcrest.MatcherAssert.assertThat;
8 import static org.hamcrest.Matchers.emptyString;
9 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
10 import static org.hamcrest.Matchers.is;
11 import static org.hamcrest.Matchers.not;
12 import static oshi.PlatformEnum.OPENBSD;
13
14 import org.junit.jupiter.api.Test;
15
16 import oshi.SystemInfo;
17 import oshi.util.platform.unix.openbsd.FstatUtil;
18
19
20
21
22 class FstatUtilTest {
23
24 @Test
25 void testFstat() {
26 if (SystemInfo.getCurrentPlatform().equals(OPENBSD)) {
27 int pid = new SystemInfo().getOperatingSystem().getProcessId();
28
29 assertThat("Number of open files must be nonnegative", FstatUtil.getOpenFiles(pid),
30 is(greaterThanOrEqualTo(0L)));
31
32 assertThat("Cwd should not be empty", FstatUtil.getCwd(pid), is(not(emptyString())));
33 }
34 }
35 }