1
2
3
4
5
6
7
8
9
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.dbcp.BasicDataSource;
21 import org.junit.jupiter.api.Assertions;
22 import org.junit.jupiter.api.BeforeEach;
23 import org.junit.jupiter.api.Test;
24
25
26
27
28 class OpenEjbBasicDatasourceAccessorTest {
29
30
31 @Tested
32 OpenEjbBasicDatasourceAccessor accessor;
33
34
35 @Mocked
36 BasicDataSource source;
37
38
39 HikariDataSource badSource;
40
41
42
43
44 @BeforeEach
45 void before() {
46 accessor = new OpenEjbBasicDatasourceAccessor();
47 badSource = new HikariDataSource();
48 }
49
50
51
52
53 @Test
54 void canMapTest() {
55 Assertions.assertTrue(accessor.canMap(source));
56 }
57
58
59
60
61 @Test
62 void cannotMapTest() {
63 Assertions.assertFalse(accessor.canMap(badSource));
64 }
65
66
67
68
69
70
71 @Test
72 void getInfoTest() throws SQLException {
73 Assertions.assertNotNull(accessor.getInfo(source));
74 }
75
76 }