1
2
3
4
5
6
7
8
9
10
11 package psiprobe.model;
12
13 import static org.junit.jupiter.api.Assertions.assertNotNull;
14 import static org.junit.jupiter.api.Assertions.assertTrue;
15
16 import com.codebox.bean.JavaBeanTester;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.junit.jupiter.api.Test;
22
23
24
25
26 class SystemInformationTest {
27
28
29
30
31 @Test
32 void javabeanTester() {
33 JavaBeanTester.builder(SystemInformation.class).loadData().skipStrictSerializable().test();
34 }
35
36 @Test
37 void testGetMemoryValues() {
38 SystemInformation si = new SystemInformation();
39 assertTrue(si.getMaxMemory() > 0);
40 assertTrue(si.getFreeMemory() >= 0);
41 assertTrue(si.getTotalMemory() > 0);
42 }
43
44 @Test
45 void testGetCpuCount() {
46 SystemInformation si = new SystemInformation();
47 assertTrue(si.getCpuCount() > 0);
48 }
49
50 @Test
51 void testGetDate() {
52 SystemInformation si = new SystemInformation();
53 assertNotNull(si.getDate());
54 }
55
56 @Test
57 void testGetWorkingDir() {
58 SystemInformation si = new SystemInformation();
59 assertNotNull(si.getWorkingDir());
60 }
61
62 @Test
63 void testGetServerInfo() {
64 SystemInformation si = new SystemInformation();
65
66 assertNotNull(si.getServerInfo());
67 }
68
69 @Test
70 void testSystemPropertySet() {
71 SystemInformation si = new SystemInformation();
72 Map<String, String> props = new HashMap<>();
73 props.put("key1", "val1");
74 si.setSystemProperties(props);
75 assertNotNull(si.getSystemPropertySet());
76 assertTrue(si.getSystemPropertySet().size() == 1);
77 }
78 }