diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:11:12 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-08 03:11:12 +0200 |
commit | c1c373f4278426308689db61f7758185e8f0401b (patch) | |
tree | 9e03af2feb69782c50464fc1e1e2ce0d6b6bb8c5 /loadtime/src/test | |
parent | a508fd5315c6330f2057c219aebc35b15d0ea497 (diff) | |
download | aspectj-c1c373f4278426308689db61f7758185e8f0401b.tar.gz aspectj-c1c373f4278426308689db61f7758185e8f0401b.zip |
'String.indexOf()' expression is replaceable with 'contains()'
Reports any String.indexOf() expressions which can be replaced with a call to the String.contains() method available in Java 5 and newer.
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'loadtime/src/test')
-rw-r--r-- | loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java index 406847eb2..5ae1d50e3 100644 --- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java +++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java @@ -359,7 +359,7 @@ public class WeavingURLClassLoaderTest extends TestCase { } catch (Exception ex) { // Expecting: java.lang.NoClassDefFoundError: LTWAspect String m = ex.getMessage(); - if (-1 == m.indexOf("java.lang.NoClassDefFoundError")) { + if (!m.contains("java.lang.NoClassDefFoundError")) { fail("Expecting java.lang.NoClassDefFoundError but caught " + ex); } } @@ -426,7 +426,7 @@ public class WeavingURLClassLoaderTest extends TestCase { // expecting error String message = ex.getMessage(); // expecting error - seems to be wrapped wrong - if (-1 == message.indexOf("around advice")) { + if (!message.contains("around advice")) { failWithException(ex); } } catch (Error ex) { @@ -461,7 +461,7 @@ public class WeavingURLClassLoaderTest extends TestCase { invokeMain(clazz, new String[] {}); fail("Should reject bad aspect MissingFile"); } catch (AbortException ae) { - assertTrue("Unexpected cause: " + ae.getMessage(), ae.getMessage().indexOf("bad aspect library") != -1); + assertTrue("Unexpected cause: " + ae.getMessage(), ae.getMessage().contains("bad aspect library")); } } |