1
2
3
4
5
6
7
8
9
10
11 package psiprobe.beans.accessors;
12
13 import static org.junit.jupiter.api.Assertions.assertEquals;
14 import static org.junit.jupiter.api.Assertions.assertFalse;
15 import static org.junit.jupiter.api.Assertions.assertNull;
16
17 import java.sql.SQLException;
18
19 import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
20 import org.junit.jupiter.api.Test;
21
22
23
24
25 class Tomcat10DbcpDatasourceAccessorTest {
26
27
28
29
30
31
32 @Test
33 void Tomcat10DbcpDatasourceAccessor() throws SQLException {
34 Tomcat10DbcpDatasourceAccessor accessor = new Tomcat10DbcpDatasourceAccessor();
35 try (BasicDataSource source = new BasicDataSource()) {
36 assertEquals("tomcat-dbcp2", accessor.getInfo(source).getType());
37 }
38 }
39
40
41
42
43
44
45 @Test
46 void Tomcat10DbcpDatasourceAccessorInvalid() throws SQLException {
47 Tomcat10DbcpDatasourceAccessor accessor = new Tomcat10DbcpDatasourceAccessor();
48 assertNull(accessor.getInfo(new Object()));
49 }
50
51
52
53
54 @Test
55 void reset() {
56 Tomcat10DbcpDatasourceAccessor accessor = new Tomcat10DbcpDatasourceAccessor();
57 assertFalse(accessor.reset(new Object()));
58 }
59
60 }