Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-06-17 10:39:42 +0000
committerLars Vogel2019-06-21 15:12:06 +0000
commit0eaa4bd2598308b1a8e170df65467e7819414399 (patch)
tree43a162ded33ceae2212159a7d10197a623cace96 /org.eclipse.ua.tests/cheatsheet
parentc2f19530cd076f93cfd52ea0fdb5b203ad67d4f6 (diff)
downloadeclipse.platform.ua-0eaa4bd2598308b1a8e170df65467e7819414399.tar.gz
eclipse.platform.ua-0eaa4bd2598308b1a8e170df65467e7819414399.tar.xz
eclipse.platform.ua-0eaa4bd2598308b1a8e170df65467e7819414399.zip
Use String.contains instead of indexOf
Change-Id: I5126c0ac5a7897a7033d65935fcb5c7db461f798 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'org.eclipse.ua.tests/cheatsheet')
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java6
2 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
index b79d7f8b8..c7df06c1b 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
@@ -95,6 +95,6 @@ public class ParseFromString {
ICheatSheet cheatSheet = parser.parse(input, CheatSheetParser.SIMPLE_ONLY);
assertNull(cheatSheet);
assertEquals(Status.ERROR, parser.getStatus().getSeverity());
- assertTrue(parser.getStatus().getMessage().indexOf("must contain at least one <item>") >= 0);
+ assertTrue(parser.getStatus().getMessage().contains("must contain at least one <item>"));
}
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
index 9ebd805af..93c71c020 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
@@ -26,7 +26,7 @@ import org.eclipse.core.runtime.MultiStatus;
public class StatusCheck {
public static void assertStatusContains(IStatus status, String text) {
- if (status.getMessage().indexOf(text) == -1) {
+ if (!status.getMessage().contains(text)) {
Assert.fail("Expected status message to contain '" + text + "' actual message is '"
+ status.getMessage() + "'");
}
@@ -36,11 +36,11 @@ public class StatusCheck {
Assert.assertTrue(status instanceof MultiStatus);
IStatus[] children = status.getChildren();
for (IStatus element : children) {
- if (element.getMessage().indexOf(text) >= 0) {
+ if (element.getMessage().contains(text)) {
return;
}
}
- if (status.getMessage().indexOf(text) == -1) {
+ if (!status.getMessage().contains(text)) {
Assert.fail("Expected status message to contain '" + text + "' status.toString = '"
+ status.toString() + "'");
}

Back to the top