Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2019-09-03 07:11:25 +0000
committerSimeon Andreev2019-09-13 08:16:35 +0000
commitd87c272207b17c4f225ceae74f67574f56de59a6 (patch)
tree96dfe11eb5bc9be2e0707e71d55f8c2fb93b979c
parenta2623e184e4ffac167eb4a7d50c61c65240fc9a4 (diff)
downloadeclipse.jdt.core-d87c272207b17c4f225ceae74f67574f56de59a6.tar.gz
eclipse.jdt.core-d87c272207b17c4f225ceae74f67574f56de59a6.tar.xz
eclipse.jdt.core-d87c272207b17c4f225ceae74f67574f56de59a6.zip
Bug 548456 - Ensure core model tests fail if test case misses suite()I20190913-1800
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