aboutsummaryrefslogtreecommitdiffstats
path: root/ajde/src/test
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:11:12 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:11:12 +0200
commitc1c373f4278426308689db61f7758185e8f0401b (patch)
tree9e03af2feb69782c50464fc1e1e2ce0d6b6bb8c5 /ajde/src/test
parenta508fd5315c6330f2057c219aebc35b15d0ea497 (diff)
downloadaspectj-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 'ajde/src/test')
-rw-r--r--ajde/src/test/java/org/aspectj/ajde/ExtensionTest.java4
-rw-r--r--ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java4
-rw-r--r--ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java4
3 files changed, 6 insertions, 6 deletions
diff --git a/ajde/src/test/java/org/aspectj/ajde/ExtensionTest.java b/ajde/src/test/java/org/aspectj/ajde/ExtensionTest.java
index a8ce3d922..ce0269930 100644
--- a/ajde/src/test/java/org/aspectj/ajde/ExtensionTest.java
+++ b/ajde/src/test/java/org/aspectj/ajde/ExtensionTest.java
@@ -79,7 +79,7 @@ public class ExtensionTest extends AjcTestCase {
private IProgramElement getChild(IProgramElement parent, String s) {
List<IProgramElement> kids = parent.getChildren();
for (IProgramElement element : kids) {
- if (element.getName().indexOf(s) != -1)
+ if (element.getName().contains(s))
return element;
}
return null;
@@ -90,7 +90,7 @@ public class ExtensionTest extends AjcTestCase {
private void findChild(String s, IProgramElement ipe) {
if (ipe == null)
return;
- if (ipe.getName().indexOf(s) != -1) {
+ if (ipe.getName().contains(s)) {
foundNode = ipe;
return;
}
diff --git a/ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
index c80f33bb6..fe642ff95 100644
--- a/ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
+++ b/ajde/src/test/java/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
@@ -53,7 +53,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
doBuild("bad-injar.lst");
messages = getMessages("bad-injar.lst");
message = (TestMessage)messages.get(0);
- assertTrue(message.getContainedMessage().getMessage().indexOf("skipping missing, empty or corrupt inpath entry") != -1);
+ assertTrue(message.getContainedMessage().getMessage().contains("skipping missing, empty or corrupt inpath entry"));
}
public void testErrorMessages() throws IOException {
@@ -63,7 +63,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
List messages = getMessages("invalid-entry.lst");
TestMessage message = (TestMessage)messages.get(0);
- assertTrue(message.getContainedMessage().getMessage(), message.getContainedMessage().getMessage().indexOf("aaa.bbb") != -1);
+ assertTrue(message.getContainedMessage().getMessage(), message.getContainedMessage().getMessage().contains("aaa.bbb"));
}
diff --git a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java
index 6ccddefc0..09d794191 100644
--- a/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java
+++ b/ajde/src/test/java/org/aspectj/ajde/ui/utils/TestBuildProgressMonitor.java
@@ -55,7 +55,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor {
if (text.startsWith("woven class ")) numWovenClassMessages++;
if (text.startsWith("compiled:")) numCompiledMessages++;
if (programmableString != null
- && text.indexOf(programmableString) != -1) {
+ && text.contains(programmableString)) {
count--;
if (count==0) {
if (debugTests) System.out.println("Just got message '"+newText+"' - asking build to cancel");
@@ -80,7 +80,7 @@ public class TestBuildProgressMonitor implements IBuildProgressMonitor {
for (Object o : messagesReceived) {
String element = (String) o;
if (element.startsWith(prefix) &&
- element.indexOf(distinguishingMarks) != -1) return true;
+ element.contains(distinguishingMarks)) return true;
}
return false;
}