1
0

Use Java 5's String#contains(CharSequence)

This commit is contained in:
Gary Gregory
2024-03-22 09:48:14 -04:00
parent b63fc7a07e
commit 0adb67eb20
3 changed files with 3 additions and 6 deletions

View File

@@ -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);
}
}

View File

@@ -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));
}
}
}

View File

@@ -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));
}
}
}