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 org.apache.commons.dbcp2.BasicDataSource;
18 import org.junit.jupiter.api.Assertions;
19 import org.junit.jupiter.api.BeforeEach;
20 import org.junit.jupiter.api.Test;
21
22
23
24
25 class Dbcp2DatasourceAccessorTest {
26
27
28 Dbcp2DatasourceAccessor accessor;
29
30
31 BasicDataSource source;
32
33
34 HikariDataSource badSource;
35
36
37
38
39 @BeforeEach
40 void before() {
41 accessor = new Dbcp2DatasourceAccessor();
42 source = new BasicDataSource();
43 badSource = new HikariDataSource();
44 }
45
46
47
48
49 @Test
50 void canMapTest() {
51 Assertions.assertTrue(accessor.canMap(source));
52 }
53
54
55
56
57 @Test
58 void cannotMapTest() {
59 Assertions.assertFalse(accessor.canMap(badSource));
60 }
61
62
63
64
65
66
67 @Test
68 void getInfoTest() throws SQLException {
69 Assertions.assertNotNull(accessor.getInfo(source));
70 }
71
72 }