diff options
| author | Noopur Gupta | 2020-05-12 11:11:26 +0000 |
|---|---|---|
| committer | Noopur Gupta | 2020-05-13 06:17:28 +0000 |
| commit | cacfb4678d1cc82a49e03dbb5c7658a4d6df3d79 (patch) | |
| tree | 2093732d7c2db52c2b3f634bf32fb52937434986 | |
| parent | 5c76f7051f56b2ea47e5d66c273632b747646694 (diff) | |
| download | eclipse.jdt.ui-cacfb4678d1cc82a49e03dbb5c7658a4d6df3d79.tar.gz eclipse.jdt.ui-cacfb4678d1cc82a49e03dbb5c7658a4d6df3d79.tar.xz eclipse.jdt.ui-cacfb4678d1cc82a49e03dbb5c7658a4d6df3d79.zip | |
Bug 544491: [JUnit 5] Result Comparison dialog not opened for nested
MultipleFailuresError
Change-Id: I70de287296404db46f4641329387133d6468fc74
3 files changed, 36 insertions, 23 deletions
diff --git a/org.eclipse.jdt.junit5.runtime/META-INF/MANIFEST.MF b/org.eclipse.jdt.junit5.runtime/META-INF/MANIFEST.MF index b0f62c8ed4..4c24b93662 100644 --- a/org.eclipse.jdt.junit5.runtime/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.junit5.runtime/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.jdt.junit5.runtime;singleton:=true -Bundle-Version: 1.0.800.qualifier +Bundle-Version: 1.0.900.qualifier Bundle-Localization: plugin Export-Package: org.eclipse.jdt.internal.junit5.runner;x-internal:=true Require-Bundle: org.eclipse.jdt.junit.runtime;bundle-version="[3.5.0,4.0.0)", diff --git a/org.eclipse.jdt.junit5.runtime/pom.xml b/org.eclipse.jdt.junit5.runtime/pom.xml index 558785cec2..b414924826 100644 --- a/org.eclipse.jdt.junit5.runtime/pom.xml +++ b/org.eclipse.jdt.junit5.runtime/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2016, 2019 Eclipse Foundation and others. + Copyright (c) 2016, 2020 Eclipse Foundation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Distribution License v1.0 which accompanies this distribution, and is available at @@ -18,6 +18,6 @@ </parent> <groupId>org.eclipse.jdt</groupId> <artifactId>org.eclipse.jdt.junit5.runtime</artifactId> - <version>1.0.800-SNAPSHOT</version> + <version>1.0.900-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> 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 bb6b7669e8..618c114399 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, 2018 IBM Corporation and others. + * Copyright (c) 2016, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -113,25 +113,7 @@ public class JUnit5TestListener implements TestExecutionListener { } if (exception instanceof MultipleFailuresError) { - String expectedStr= ""; //$NON-NLS-1$ - String actualStr= ""; //$NON-NLS-1$ - String delimiter= "\n\n"; //$NON-NLS-1$ - List<Throwable> failures= ((MultipleFailuresError) exception).getFailures(); - for (Throwable assertionError : failures) { - if (assertionError instanceof AssertionFailedError) { - AssertionFailedError assertionFailedError= (AssertionFailedError) assertionError; - ValueWrapper expected= assertionFailedError.getExpected(); - ValueWrapper actual= assertionFailedError.getActual(); - if (expected == null || actual == null) { - return null; - } - expectedStr+= expected.getStringRepresentation() + delimiter; - actualStr+= actual.getStringRepresentation() + delimiter; - } else { - return null; - } - } - return new FailedComparison(expectedStr, actualStr); + return getComparisonForMultipleFailures(exception); } // Avoid reference to ComparisonFailure initially to avoid NoClassDefFoundError for ComparisonFailure when junit.jar is not on the build path @@ -148,6 +130,37 @@ public class JUnit5TestListener implements TestExecutionListener { return null; } + protected FailedComparison getComparisonForMultipleFailures(Throwable exception) { + String expectedStr= ""; //$NON-NLS-1$ + String actualStr= ""; //$NON-NLS-1$ + String delimiter= "\n\n"; //$NON-NLS-1$ + List<Throwable> failures= ((MultipleFailuresError) exception).getFailures(); + for (Throwable assertionError : failures) { + if (assertionError instanceof MultipleFailuresError) { + FailedComparison failedComparison= getComparisonForMultipleFailures(assertionError); + String expected= failedComparison.getExpected(); + String actual= failedComparison.getActual(); + if (expected == null || actual == null) { + return null; + } + expectedStr+= expected; + actualStr+= actual; + } else if (assertionError instanceof AssertionFailedError) { + AssertionFailedError assertionFailedError= (AssertionFailedError) assertionError; + ValueWrapper expected= assertionFailedError.getExpected(); + ValueWrapper actual= assertionFailedError.getActual(); + if (expected == null || actual == null) { + return null; + } + expectedStr+= expected.getStringRepresentation() + delimiter; + actualStr+= actual.getStringRepresentation() + delimiter; + } else { + return null; + } + } + return new FailedComparison(expectedStr, actualStr); + } + @Override public void executionSkipped(TestIdentifier testIdentifier, String reason) { if (testIdentifier.isContainer() && fTestPlan != null) { |
