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

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

commit 18ae8abf57c1f8b317e26b6546c32fc6b35b475a
Author: Emmanuel Bourg <ebo...@apache.org>
AuthorDate: Fri Dec 4 13:29:49 2020 +0100

    Use String.contains() instead of indexOf()
---
 src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java 
b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
index f74fc1b..531d9f6 100644
--- a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
+++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSource.java
@@ -276,7 +276,7 @@ public class TestBasicDataSource extends TestConnectionPool 
{
         try (Connection c = ds.getConnection()) {
             fail("expected SQLException");
         } catch (final SQLException e) {
-            if (e.toString().indexOf("invalid") < 0) {
+            if (!e.toString().contains("invalid")) {
                 fail("expected detailed error message");
             }
         }
@@ -289,7 +289,7 @@ public class TestBasicDataSource extends TestConnectionPool 
{
         try (Connection c = ds.getConnection()) {
             fail("expected SQLException");
         } catch (final SQLException ex) {
-            if (ex.toString().indexOf("timeout") < 0) {
+            if (!ex.toString().contains("timeout")) {
                 fail("expected timeout error message");
             }
         }
@@ -344,7 +344,7 @@ public class TestBasicDataSource extends TestConnectionPool 
{
             fail("expected SQLException");
         }
         catch (final SQLException e) {
-            if (e.toString().indexOf("invalid") < 0) {
+            if (!e.toString().contains("invalid")) {
                 fail("expected detailed error message");
             }
         }

Reply via email to