This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git


The following commit(s) were added to refs/heads/master by this push:
     new 98933fef Make test more readable and maintainable, and less verbose
98933fef is described below

commit 98933fef0bb41372a59ec566b791aa32cc54fb48
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Oct 1 10:40:29 2024 -0400

    Make test more readable and maintainable, and less verbose
    
    - Use JUnit 5 APIs
    - Be consistent throughout tests
---
 pom.xml                                                    | 14 --------------
 .../java/org/apache/commons/dbcp2/TestBasicDataSource.java |  5 +----
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2eff6db1..fcb72d63 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,40 +59,34 @@
       <artifactId>commons-pool2</artifactId>
       <version>${commons.pool.version}</version>
     </dependency>
-
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
       <version>1.3.4</version>
     </dependency>
-
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter</artifactId>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <version>4.11.0</version>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <version>3.17.0</version>
       <scope>test</scope>
     </dependency>
-
     <!-- For managed connections -->
     <dependency>
       <groupId>jakarta.transaction</groupId>
       <artifactId>jakarta.transaction-api</artifactId>
       <version>1.3.3</version>
     </dependency>
-
     <!-- tomcat naming jars for jndi reference tests -->
     <dependency>
       <groupId>tomcat</groupId>
@@ -100,14 +94,12 @@
       <version>5.0.28</version>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>tomcat</groupId>
       <artifactId>naming-java</artifactId>
       <version>5.0.28</version>
       <scope>test</scope>
     </dependency>
-
     <!-- for testing of managed connections -->
     <dependency>
       <groupId>org.apache.geronimo.modules</groupId>
@@ -163,12 +155,6 @@
       <version>3.4.3.Final</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest</artifactId>
-      <version>3.0</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <properties>
diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java 
b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index 7e729028..bffe8387 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -17,7 +17,6 @@
 
 package org.apache.commons.dbcp2;
 
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -49,7 +48,6 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import javax.sql.DataSource;
 
-import org.hamcrest.CoreMatchers;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -577,8 +575,7 @@ public class TestBasicDataSource extends TestConnectionPool 
{
         }
         StackMessageLog.clear();
         ds.close();
-        assertThat(StackMessageLog.popMessage(),
-                
CoreMatchers.not(CoreMatchers.containsString("InstanceNotFoundException")));
+        assertNull(StackMessageLog.popMessage());
         assertNull(ds.getRegisteredJmxName());
     }
 

Reply via email to