Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoopur Gupta2018-06-26 09:47:49 +0000
committerNoopur Gupta2018-06-26 09:47:49 +0000
commit53c98a73a1747350bd9101d1607cc4432eb5b037 (patch)
tree75d149322e71ebb6c4d205bf2aa3871dcc85843d
parent182a1609f5d754dfb8873f8e2f6d3fc1dd560a6b (diff)
downloadeclipse.jdt.ui-53c98a73a1747350bd9101d1607cc4432eb5b037.tar.gz
eclipse.jdt.ui-53c98a73a1747350bd9101d1607cc4432eb5b037.tar.xz
eclipse.jdt.ui-53c98a73a1747350bd9101d1607cc4432eb5b037.zip
Bug 536005: [JUnit 5] AssumptionViolatedException on class level shownI20180628-0230I20180627-2020I20180627-2000
-rw-r--r--org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java50
1 files changed, 21 insertions, 29 deletions
diff --git a/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java b/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
index 386a0c5a52..b095fe923d 100644
--- a/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
+++ b/org.eclipse.jdt.junit5.runtime/src/org/eclipse/jdt/internal/junit5/runner/JUnit5TestListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016, 2017 IBM Corporation and others.
+ * Copyright (c) 2016, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -65,38 +65,30 @@ public class JUnit5TestListener implements TestExecutionListener {
@Override
public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
- Status result= testExecutionResult.getStatus();
+ notifyIfNotSuccessful(testIdentifier, testExecutionResult);
if (testIdentifier.isTest()) {
- if (result != Status.SUCCESSFUL) {
- String trace= ""; //$NON-NLS-1$
- FailedComparison comparison= null;
- String status= MessageIds.TEST_FAILED;
-
- boolean assumptionFailed= result == Status.ABORTED;
- Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
- if (throwableOp.isPresent()) {
- Throwable exception= throwableOp.get();
- trace= getTrace(exception);
- comparison= getFailedComparison(exception);
- status= (assumptionFailed || exception instanceof AssertionError) ? MessageIds.TEST_FAILED : MessageIds.TEST_ERROR;
- }
-
- ITestIdentifier identifier= getIdentifier(testIdentifier, false, assumptionFailed);
- fNotified.notifyTestFailed(new TestReferenceFailure(identifier, status, trace, comparison));
- }
-
fNotified.notifyTestEnded(getIdentifier(testIdentifier, false, false));
+ }
+ }
- } else { // container
- if (result != Status.SUCCESSFUL) {
- Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
- String trace= ""; //$NON-NLS-1$
- if (throwableOp.isPresent()) {
- trace= getTrace(throwableOp.get());
- }
- ITestIdentifier identifier= getIdentifier(testIdentifier, false, false);
- fNotified.notifyTestFailed(new TestReferenceFailure(identifier, MessageIds.TEST_ERROR, trace));
+ private void notifyIfNotSuccessful(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) {
+ Status result= testExecutionResult.getStatus();
+ if (result != Status.SUCCESSFUL) {
+ String trace= ""; //$NON-NLS-1$
+ FailedComparison comparison= null;
+ String status= MessageIds.TEST_FAILED;
+
+ boolean assumptionFailed= result == Status.ABORTED;
+ Optional<Throwable> throwableOp= testExecutionResult.getThrowable();
+ if (throwableOp.isPresent()) {
+ Throwable exception= throwableOp.get();
+ trace= getTrace(exception);
+ comparison= getFailedComparison(exception);
+ status= (assumptionFailed || exception instanceof AssertionError) ? MessageIds.TEST_FAILED : MessageIds.TEST_ERROR;
}
+
+ ITestIdentifier identifier= getIdentifier(testIdentifier, false, assumptionFailed);
+ fNotified.notifyTestFailed(new TestReferenceFailure(identifier, status, trace, comparison));
}
}

Back to the top