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
|
// but it will delegate to JUnit class loader first
|
||||||
@Override
|
@Override
|
||||||
public Class loadClass(final String name) throws ClassNotFoundException {
|
public Class loadClass(final String name) throws ClassNotFoundException {
|
||||||
|
|
||||||
// isolates all logging classes, application in the same class loader too.
|
// isolates all logging classes, application in the same class loader too.
|
||||||
// filters exceptions to simplify handling in test
|
// filters exceptions to simplify handling in test
|
||||||
for (final String element : LOG_PCKG) {
|
for (final String element : LOG_PCKG) {
|
||||||
if (name.startsWith(element) && name.indexOf("Exception") == -1) {
|
if (name.startsWith(element) && !name.contains("Exception")) {
|
||||||
return def(name);
|
return def(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,8 +149,7 @@ public class TcclDisabledTestCase extends TestCase {
|
|||||||
assertNotNull(log); // silence compiler warning about unused var
|
assertNotNull(log); // silence compiler warning about unused var
|
||||||
} catch (final LogConfigurationException ex) {
|
} catch (final LogConfigurationException ex) {
|
||||||
// ok, expected
|
// ok, expected
|
||||||
final int index = ex.getMessage().indexOf(MY_LOG_IMPL);
|
assertTrue("MyLog not found", ex.getMessage().contains(MY_LOG_IMPL));
|
||||||
assertTrue("MyLog not found", index >= 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,8 +144,7 @@ public class TcclDisabledTestCase extends TestCase {
|
|||||||
} catch (final org.apache.commons.logging.LogConfigurationException ex) {
|
} catch (final org.apache.commons.logging.LogConfigurationException ex) {
|
||||||
// ok, custom MyLogFactoryImpl as specified in props_disable_tccl
|
// ok, custom MyLogFactoryImpl as specified in props_disable_tccl
|
||||||
// could not be found.
|
// could not be found.
|
||||||
final int index = ex.getMessage().indexOf(MY_LOG_FACTORY_IMPL);
|
assertTrue("MylogFactoryImpl not found", ex.getMessage().contains(MY_LOG_FACTORY_IMPL));
|
||||||
assertTrue("MylogFactoryImpl not found", index >= 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user