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.beans.accessors;
12  
13  import com.zaxxer.hikari.HikariDataSource;
14  
15  import java.sql.SQLException;
16  
17  import mockit.Mocked;
18  import mockit.Tested;
19  
20  import org.apache.openejb.resource.jdbc.managed.local.ManagedDataSource;
21  import org.junit.jupiter.api.Assertions;
22  import org.junit.jupiter.api.BeforeEach;
23  import org.junit.jupiter.api.Disabled;
24  import org.junit.jupiter.api.Test;
25  
26  /**
27   * The Class OpenEjbManagedDatasourceAccessorTest.
28   */
29  class OpenEjbManagedDatasourceAccessorTest {
30  
31    /** The accessor. */
32    @Tested
33    OpenEjbManagedDatasourceAccessor accessor;
34  
35    /** The source. */
36    @Mocked
37    ManagedDataSource source;
38  
39    /** The bad source. */
40    HikariDataSource badSource;
41  
42    /**
43     * Before.
44     */
45    @BeforeEach
46    void before() {
47      accessor = new OpenEjbManagedDatasourceAccessor();
48      badSource = new HikariDataSource();
49    }
50  
51    /**
52     * Can map test.
53     */
54    @Disabled
55    @Test
56    void canMapTest() {
57      Assertions.assertTrue(accessor.canMap(source));
58    }
59  
60    /**
61     * Cannot map test.
62     */
63    @Test
64    void cannotMapTest() {
65      Assertions.assertFalse(accessor.canMap(badSource));
66    }
67  
68    /**
69     * Gets the info test.
70     *
71     * @throws SQLException the sql exception
72     */
73    @Test
74    void getInfoTest() throws SQLException {
75      accessor.getInfo(source);
76    }
77  
78  }