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-logging.git


The following commit(s) were added to refs/heads/master by this push:
     new 0adb67e  Use Java 5's String#contains(CharSequence)
0adb67e is described below

commit 0adb67eb208ab539727c339d810ed8db2f3621f2
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Mar 22 09:48:14 2024 -0400

    Use Java 5's String#contains(CharSequence)
---
 src/test/java/org/apache/commons/logging/LoadTestCase.java             | 3 +--
 .../java/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java | 3 +--
 .../apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java   | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/logging/LoadTestCase.java 
b/src/test/java/org/apache/commons/logging/LoadTestCase.java
index 0005202..a2eda91 100644
--- a/src/test/java/org/apache/commons/logging/LoadTestCase.java
+++ b/src/test/java/org/apache/commons/logging/LoadTestCase.java
@@ -78,11 +78,10 @@ public class LoadTestCase extends TestCase {
         // but it will delegate to JUnit class loader first
         @Override
         public Class loadClass(final String name) throws 
ClassNotFoundException {
-
             // isolates all logging classes, application in the same class 
loader too.
             // filters exceptions to simplify handling in test
             for (final String element : LOG_PCKG) {
-                if (name.startsWith(element) && name.indexOf("Exception") == 
-1) {
+                if (name.startsWith(element) && !name.contains("Exception")) {
                     return def(name);
                 }
             }
diff --git 
a/src/test/java/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java 
b/src/test/java/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java
index 9a52c3b..8a787fe 100644
--- 
a/src/test/java/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java
+++ 
b/src/test/java/org/apache/commons/logging/tccl/log/TcclDisabledTestCase.java
@@ -149,8 +149,7 @@ public class TcclDisabledTestCase extends TestCase {
             assertNotNull(log); // silence compiler warning about unused var
         } catch (final LogConfigurationException ex) {
             // ok, expected
-            final int index = ex.getMessage().indexOf(MY_LOG_IMPL);
-            assertTrue("MyLog not found", index >= 0);
+            assertTrue("MyLog not found", 
ex.getMessage().contains(MY_LOG_IMPL));
         }
     }
 }
diff --git 
a/src/test/java/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java
 
b/src/test/java/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java
index df9634e..e8f2e88 100644
--- 
a/src/test/java/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java
+++ 
b/src/test/java/org/apache/commons/logging/tccl/logfactory/TcclDisabledTestCase.java
@@ -144,8 +144,7 @@ public class TcclDisabledTestCase extends TestCase {
         } catch (final org.apache.commons.logging.LogConfigurationException 
ex) {
             // ok, custom MyLogFactoryImpl as specified in props_disable_tccl
             // could not be found.
-            final int index = ex.getMessage().indexOf(MY_LOG_FACTORY_IMPL);
-            assertTrue("MylogFactoryImpl not found", index >= 0);
+            assertTrue("MylogFactoryImpl not found", 
ex.getMessage().contains(MY_LOG_FACTORY_IMPL));
         }
     }
 }

Reply via email to