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