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.model;
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 DataSourceInfoTest.
20   */
21  class DataSourceInfoTest {
22  
23    /**
24     * Javabean tester.
25     */
26    @Test
27    void javabeanTester() {
28      JavaBeanTester.builder(DataSourceInfo.class).loadData().test();
29    }
30  
31    /**
32     * Test get busy score.
33     */
34    @Test
35    void busyScore() {
36      final DataSourceInfo dataSourceInfo = new DataSourceInfo();
37      dataSourceInfo.setBusyConnections(1);
38      dataSourceInfo.setMaxConnections(5);
39      Assertions.assertEquals(20, dataSourceInfo.getBusyScore());
40    }
41  
42    /**
43     * Test get established score.
44     */
45    @Test
46    void establishedScore() {
47      final DataSourceInfo dataSourceInfo = new DataSourceInfo();
48      dataSourceInfo.setEstablishedConnections(1);
49      dataSourceInfo.setMaxConnections(5);
50      Assertions.assertEquals(20, dataSourceInfo.getEstablishedScore());
51    }
52  
53  }