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.junit.jupiter.api.Assertions.assertInstanceOf;
8   import static org.junit.jupiter.api.Assertions.assertNotNull;
9   
10  import java.util.EnumMap;
11  import java.util.Map;
12  
13  import org.junit.jupiter.api.Test;
14  import org.junit.jupiter.api.condition.EnabledOnOs;
15  import org.junit.jupiter.api.condition.OS;
16  
17  @EnabledOnOs(OS.LINUX)
18  class DiskStatsTest {
19  
20      @Test
21      void testGetDiskStats() {
22          Map<String, Map<DiskStats.IoStat, Long>> map = DiskStats.getDiskStats();
23          assertNotNull(map, "DiskStats should not be null");
24  
25          map.forEach((key, value) -> {
26              assertNotNull(value, "Entry should not have a null map!");
27              assertInstanceOf(EnumMap.class, value, "Value should be enum map!");
28          });
29      }
30  }