Use Java 5's String#contains(CharSequence)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user