Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2014-11-14 19:45:15 +0000
committerMarkus Keller2014-11-14 19:47:41 +0000
commit94f85f49f97873b37d3444cf7f2c003d71348970 (patch)
treec4c87e1fcabcfc965324bd571ac6200e925a682e
parent3b64020e89d0cefe9dca260edf6f9f633a03f4e9 (diff)
downloadeclipse.jdt.ui-94f85f49f97873b37d3444cf7f2c003d71348970.tar.gz
eclipse.jdt.ui-94f85f49f97873b37d3444cf7f2c003d71348970.tar.xz
eclipse.jdt.ui-94f85f49f97873b37d3444cf7f2c003d71348970.zip
Bug 443498: [JUnit] support re-running 'virtual' suites, e.g. from the 'Parameterized' runner
-rw-r--r--org.eclipse.jdt.junit/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jdt.junit/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.junit/pom.xml2
-rw-r--r--org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/launcher/JUnitLaunchShortcut.java29
-rw-r--r--org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/DescriptionMatcher.java14
-rw-r--r--org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestLoader.java6
-rw-r--r--org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java4
-rw-r--r--org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/SubForestFilter.java14
8 files changed, 44 insertions, 29 deletions
diff --git a/org.eclipse.jdt.junit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jdt.junit/.settings/org.eclipse.jdt.core.prefs
index 6d3bbad73a..03ccaf2cae 100644
--- a/org.eclipse.jdt.junit/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jdt.junit/.settings/org.eclipse.jdt.core.prefs
@@ -204,7 +204,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
diff --git a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
index 99b840782d..317980fd4e 100644
--- a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.junit;singleton:=true
-Bundle-Version: 3.7.400.qualifier
+Bundle-Version: 3.8.0.qualifier
Bundle-Activator: org.eclipse.jdt.internal.junit.ui.JUnitPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.junit/pom.xml b/org.eclipse.jdt.junit/pom.xml
index d05e5b75ff..e18d4e68a3 100644
--- a/org.eclipse.jdt.junit/pom.xml
+++ b/org.eclipse.jdt.junit/pom.xml
@@ -18,6 +18,6 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.junit</artifactId>
- <version>3.7.400-SNAPSHOT</version>
+ <version>3.8.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/launcher/JUnitLaunchShortcut.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/launcher/JUnitLaunchShortcut.java
index 330a0430fe..ce41e51f64 100644
--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/launcher/JUnitLaunchShortcut.java
+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/junit/launcher/JUnitLaunchShortcut.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -23,8 +23,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.resources.IResource;
@@ -298,8 +296,11 @@ public class JUnitLaunchShortcut implements ILaunchShortcut2 {
* element type can only be of type {@link IJavaProject}, {@link IPackageFragmentRoot},
* {@link IPackageFragment}, {@link IType} or {@link IMethod}.
*
- * Clients can extend this method (should call super) to configure additional attributes on the
- * launch configuration working copy.
+ * <p>Clients can extend this method (should call super) to configure additional attributes on the
+ * launch configuration working copy. Note that this method calls
+ * <code>{@link #createLaunchConfiguration(IJavaElement, String) createLaunchConfiguration}(element, null)</code>.
+ * Extenders are recommended to extend the two-args method instead of this method.
+ * </p>
*
* @param element element to launch
*
@@ -316,15 +317,18 @@ public class JUnitLaunchShortcut implements ILaunchShortcut2 {
* element type can only be of type {@link IJavaProject}, {@link IPackageFragmentRoot},
* {@link IPackageFragment}, {@link IType} or {@link IMethod}.
*
- * Clients can extend this method (should call super) to configure additional attributes on the
+ * <p>Clients can extend this method (should call super) to configure additional attributes on the
* launch configuration working copy.
+ * </p>
*
* @param element element to launch
* @param testName name of the test to launch, e.g. the method name or an artificial name
- * created by a JUnit runner
+ * created by a JUnit runner, or <code>null</code> if none. The testName is
+ * ignored if the element is an IMethod; the method name is used in that case.
*
* @return a launch configuration working copy for the given element
* @throws CoreException if creation failed
+ * @since 3.8
*/
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element, String testName) throws CoreException {
final String mainTypeQualifiedName;
@@ -344,11 +348,7 @@ public class JUnitLaunchShortcut implements ILaunchShortcut2 {
break;
}
case IJavaElement.METHOD: {
- if (testName != null) {
- String message= "Test-names can not be specified when launching a Java method.";
- throw new CoreException(new Status(IStatus.ERROR, JUnitPlugin.PLUGIN_ID, message));
- }
- testName= element.getElementName();
+ testName= element.getElementName(); // Test-names can not be specified when launching a Java method.
IMethod method= (IMethod)element;
containerHandleId= EMPTY_STRING;
mainTypeQualifiedName= method.getDeclaringType().getFullyQualifiedName('.');
@@ -378,13 +378,14 @@ public class JUnitLaunchShortcut implements ILaunchShortcut2 {
}
/**
- * Computes a human-readable name for a launch configuration. The name serve's as suggestion and
- * it's the callers responsibility to make it valid and unique.
+ * Computes a human-readable name for a launch configuration. The name serves as a suggestion and
+ * it's the caller's responsibility to make it valid and unique.
*
* @param element The Java Element that will be executed.
* @param fullTestName The test name. See
* org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher for supported formats.
* @return The suggested name for the launch configuration.
+ * @since 3.8
*/
protected String suggestLaunchConfigurationName(IJavaElement element, String fullTestName) {
switch (element.getElementType()) {
diff --git a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/DescriptionMatcher.java b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/DescriptionMatcher.java
index 659a210b65..7d6e97c4b7 100644
--- a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/DescriptionMatcher.java
+++ b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/DescriptionMatcher.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Moritz Eysholdt 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Moritz Eysholdt <moritz.eysholdt@itemis.de> - initial API and implementation
+ *******************************************************************************/
package org.eclipse.jdt.internal.junit4.runner;
import java.util.ArrayList;
@@ -12,8 +22,6 @@ import org.junit.runners.Parameterized;
* This class matches JUnit's {@link Description} against a string.
*
* See {@link #create(Class, String)} for details.
- *
- * @author Moritz Eysholdt
*/
public abstract class DescriptionMatcher {
@@ -69,8 +77,6 @@ public abstract class DescriptionMatcher {
* Please be aware that {@link Description#getMethodName()} can be any value a JUnit runner has
* computed. It is not necessarily a valid method name. For example, {@link Parameterized} uses
* the format 'methodname[i]', with 'i' being the row index in the table of test data.
- *
- * @author Moritz Eysholdt
*/
private static class LeadingIdentifierMatcher extends DescriptionMatcher {
diff --git a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestLoader.java b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestLoader.java
index d9524069b1..c077f2b61e 100644
--- a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestLoader.java
+++ b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestLoader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2014 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
@@ -105,8 +105,8 @@ public class JUnit4TestLoader implements ITestLoader {
int modifiers= setup.getModifiers();
if (setup.getReturnType() == Test.class && Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers))
return true;
- } catch (@SuppressWarnings("unused") SecurityException e1) {
- } catch (@SuppressWarnings("unused") NoSuchMethodException e) {
+ } catch (SecurityException e1) {
+ } catch (NoSuchMethodException e) {
}
return false;
}
diff --git a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java
index 93bdc3f478..8888de3153 100644
--- a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java
+++ b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2014 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
@@ -85,7 +85,7 @@ public class JUnit4TestReference implements ITestReference {
notifier.fireTestRunStarted(fRunner.getDescription());
fRunner.run(notifier);
notifier.fireTestRunFinished(result);
- } catch (@SuppressWarnings("unused") StoppedByUserException e) {
+ } catch (StoppedByUserException e) {
// not interesting, see https://bugs.eclipse.org/329498
} finally {
notifier.removeListener(listener);
diff --git a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/SubForestFilter.java b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/SubForestFilter.java
index f9ed04a0d6..b9d366139e 100644
--- a/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/SubForestFilter.java
+++ b/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/SubForestFilter.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Moritz Eysholdt 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Moritz Eysholdt <moritz.eysholdt@itemis.de> - initial API and implementation
+ *******************************************************************************/
package org.eclipse.jdt.internal.junit4.runner;
import java.util.HashSet;
@@ -12,9 +22,7 @@ import org.junit.runner.manipulation.NoTestsRemainException;
* This filter keeps all matched {@link Description}s in a tree, including the children and
* container of the matched Description.
*
- * It is allowed to match more then one Description.
- *
- * @author Moritz Eysholdt
+ * It is allowed to match more than one Description.
*/
public class SubForestFilter extends Filter {

Back to the top