Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2019-09-03 07:11:25 +0000
committerManoj Palat2019-09-20 09:55:40 +0000
commit6f53b77c6a3a8fdf3f785ca0e6a1e8c1179e4ef6 (patch)
tree545c8668d26f4bfca7bb809cccc21804e66de112
parent7210472c564fe8719dd0241666434fa288f5251b (diff)
downloadeclipse.jdt.core-6f53b77c6a3a8fdf3f785ca0e6a1e8c1179e4ef6.tar.gz
eclipse.jdt.core-6f53b77c6a3a8fdf3f785ca0e6a1e8c1179e4ef6.tar.xz
eclipse.jdt.core-6f53b77c6a3a8fdf3f785ca0e6a1e8c1179e4ef6.zip
Bug 548456 - Ensure core model tests fail if test case misses suite()
org.eclipse.jdt.core.tests.model.AllJavaModelTests will visit each of the included test cases and call its suite() method over reflection to instantiate the test case. If the suite() method is not found, an exception stack trace is printed instead of throwing an exception. So forgetting the suite() method in a new test case does not result in a failure. This can easily hide the fact that the new test case is not running at all. This change re-throws the exception instead of only printing its stack trace, so that missing suite() method in an included test case results in a failure. Change-Id: I2e8cc25cca943961caf815cd9bc04eaf781facd4 Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
index 487061a824..1fa9b48651 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
@@ -268,17 +268,17 @@ public static Test suite() {
suiteMethod = clazz.getDeclaredMethod("suite", new Class[0]);
} catch (NoSuchMethodException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to find suite() method for: " + clazz, e);
}
Object test;
try {
test = suiteMethod.invoke(null, new Object[0]);
} catch (IllegalAccessException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to invoke suite() method for: " + clazz, e);
} catch (InvocationTargetException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to invoke suite() method for: " + clazz, e);
}
suite.addTest((Test) test);
}

Back to the top