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