View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe;
12  
13  import com.codebox.bean.JavaBeanTester;
14  
15  import org.junit.jupiter.api.Assertions;
16  import org.junit.jupiter.api.Test;
17  
18  /**
19   * The Class UtilsTest.
20   */
21  class UtilsBaseTest {
22  
23    /**
24     * Calc pool usage score test.
25     */
26    @Test
27    void calcPoolUsageScoreTest() {
28      Assertions.assertEquals(100, UtilsBase.calcPoolUsageScore(5, 5));
29      Assertions.assertEquals(0, UtilsBase.calcPoolUsageScore(0, 5));
30    }
31  
32    /**
33     * To int test.
34     */
35    @Test
36    void toIntTest() {
37      Assertions.assertEquals(5, UtilsBase.toInt("garbage", 5));
38      Assertions.assertEquals(3, UtilsBase.toInt("3", 5));
39      Assertions.assertEquals(5, UtilsBase.toInt("3 3", 5));
40      Assertions.assertEquals(5, UtilsBase.toInt((String) null, 5));
41    }
42  
43    /**
44     * JavabeanTester Private Constructor.
45     */
46    @Test
47    void javabeanTester() {
48      JavaBeanTester.builder(UtilsBase.class).testPrivateConstructor();
49    }
50  
51  }