View Javadoc
1   /*
2    * Copyright 2021-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.driver.linux.proc;
6   
7   import static org.hamcrest.MatcherAssert.assertThat;
8   import static org.hamcrest.Matchers.greaterThanOrEqualTo;
9   
10  import org.junit.jupiter.api.Test;
11  import org.junit.jupiter.api.condition.EnabledOnOs;
12  import org.junit.jupiter.api.condition.OS;
13  
14  @EnabledOnOs(OS.LINUX)
15  class UpTimeTest {
16  
17      @Test
18      void testGetSystemUptimeSeconds() {
19          double uptime = UpTime.getSystemUptimeSeconds();
20          assertThat("Uptime should be nonnegative", uptime, greaterThanOrEqualTo(0d));
21      }
22  }