1
2
3
4
5
6
7
8
9
10
11 package psiprobe.beans.accessors;
12
13 import com.mchange.v2.c3p0.ComboPooledDataSource;
14 import com.mchange.v2.c3p0.jboss.C3P0PooledDataSource;
15
16 import java.sql.SQLException;
17
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 C3P0DatasourceAccessorTest {
26
27
28 C3P0DatasourceAccessor accessor;
29
30
31 ComboPooledDataSource source;
32
33
34 C3P0PooledDataSource badSource;
35
36
37
38
39 @BeforeEach
40 void before() {
41 accessor = new C3P0DatasourceAccessor();
42 source = new ComboPooledDataSource();
43 badSource = new C3P0PooledDataSource();
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 }