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 Tomcat11DbcpDatasourceAccessorTest {
26
27
28
29
30
31
32 @Test
33 void Tomcat11DbcpDatasourceAccessor() throws SQLException {
34 Tomcat11DbcpDatasourceAccessor accessor = new Tomcat11DbcpDatasourceAccessor();
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 Tomcat11DbcpDatasourceAccessorInvalid() throws SQLException {
47 Tomcat11DbcpDatasourceAccessor accessor = new Tomcat11DbcpDatasourceAccessor();
48 assertNull(accessor.getInfo(new Object()));
49 }
50
51
52
53
54 @Test
55 void reset() {
56 Tomcat11DbcpDatasourceAccessor accessor = new Tomcat11DbcpDatasourceAccessor();
57 assertFalse(accessor.reset(new Object()));
58 }
59
60 }