Triggered save actions on CoreTest
Sets the brackets
Change-Id: Ib74f693ba5ce5db8600de63c1744597e98845bd0
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java b/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
index cfd6734..4c431d8 100644
--- a/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
+++ b/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/CoreTest.java
@@ -51,8 +51,9 @@
public static void debug(String message) {
String id = "org.eclipse.core.tests.harness/debug";
String option = Platform.getDebugOption(id);
- if (Boolean.TRUE.toString().equalsIgnoreCase(option))
+ if (Boolean.TRUE.toString().equalsIgnoreCase(option)) {
System.out.println(message);
+ }
}
/**
@@ -64,23 +65,26 @@
if (e instanceof CoreException) {
IStatus status = ((CoreException) e).getStatus();
//if the status does not have an exception, print the stack for this one
- if (status.getException() == null)
+ if (status.getException() == null) {
e.printStackTrace();
+ }
write(status, 0);
- } else
+ } else {
e.printStackTrace();
+ }
AssertionFailedError assertFail = new AssertionFailedError(message + ": " + e);
assertFail.initCause(e);
throw assertFail;
}
private static void indent(OutputStream output, int indent) {
- for (int i = 0; i < indent; i++)
+ for (int i = 0; i < indent; i++) {
try {
output.write("\t".getBytes());
} catch (IOException e) {
// ignore
}
+ }
}
public static void log(String pluginID, IStatus status) {
@@ -113,8 +117,9 @@
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (IStatus element : children)
+ for (IStatus element : children) {
write(element, indent + 1);
+ }
}
}
@@ -133,8 +138,9 @@
* @since 3.2
*/
protected void assertClose(InputStream stream) {
- if (stream == null)
+ if (stream == null) {
return;
+ }
try {
stream.close();
} catch (IOException e) {
@@ -149,8 +155,9 @@
* @since 3.2
*/
protected void assertClose(OutputStream stream) {
- if (stream == null)
+ if (stream == null) {
return;
+ }
try {
stream.close();
} catch (IOException e) {
@@ -159,14 +166,18 @@
}
protected void assertEquals(String message, Object[] expected, Object[] actual) {
- if (expected == null && actual == null)
+ if (expected == null && actual == null) {
return;
- if (expected == null || actual == null)
+ }
+ if (expected == null || actual == null) {
fail(message);
- if (expected.length != actual.length)
+ }
+ if (expected.length != actual.length) {
fail(message);
- for (int i = 0; i < expected.length; i++)
+ }
+ for (int i = 0; i < expected.length; i++) {
assertEquals(message, expected[i], actual[i]);
+ }
}
protected void assertEquals(String message, Object[] expected, Object[] actual, boolean orderImportant) {
@@ -176,24 +187,31 @@
return;
}
// otherwise use this method and check that the arrays are equal in any order
- if (expected == null && actual == null)
+ if (expected == null && actual == null) {
return;
- if (expected == actual)
+ }
+ if (expected == actual) {
return;
- if (expected == null || actual == null)
+ }
+ if (expected == null || actual == null) {
assertTrue(message + ".1", false);
- if (expected.length != actual.length)
+ }
+ if (expected.length != actual.length) {
assertTrue(message + ".2", false);
+ }
boolean[] found = new boolean[expected.length];
for (Object element : expected) {
for (int j = 0; j < expected.length; j++) {
- if (!found[j] && element.equals(actual[j]))
+ if (!found[j] && element.equals(actual[j])) {
found[j] = true;
+ }
}
}
- for (int i = 0; i < found.length; i++)
- if (!found[i])
+ for (int i = 0; i < found.length; i++) {
+ if (!found[i]) {
assertTrue(message + ".3." + i, false);
+ }
+ }
}
/**
@@ -384,8 +402,9 @@
try {
try {
int c = 0;
- while ((c = input.read()) != -1)
+ while ((c = input.read()) != -1) {
output.write(c);
+ }
} finally {
input.close();
output.close();
@@ -403,8 +422,9 @@
public void transferDataWithoutClose(InputStream input, OutputStream output) {
try {
int c = 0;
- while ((c = input.read()) != -1)
+ while ((c = input.read()) != -1) {
output.write(c);
+ }
} catch (IOException e) {
e.printStackTrace();
assertTrue(e.toString(), false);
@@ -412,8 +432,9 @@
}
public static void assertSame(String message, int expected, int actual) {
- if (expected == actual)
+ if (expected == actual) {
return;
+ }
failNotSame(message, expected, actual);
}
@@ -427,8 +448,9 @@
}
public static void assertSame(String message, boolean expected, boolean actual) {
- if (expected == actual)
+ if (expected == actual) {
return;
+ }
failNotSame(message, expected, actual);
}
@@ -442,8 +464,9 @@
}
public static void assertSame(String message, float expected, float actual) {
- if (expected == actual)
+ if (expected == actual) {
return;
+ }
failNotSame(message, expected, actual);
}
@@ -457,8 +480,9 @@
}
public static void assertSame(String message, double expected, double actual) {
- if (expected == actual)
+ if (expected == actual) {
return;
+ }
failNotSame(message, expected, actual);
}
@@ -472,8 +496,9 @@
}
public static void assertSame(String message, long expected, long actual) {
- if (expected == actual)
+ if (expected == actual) {
return;
+ }
failNotSame(message, expected, actual);
}