Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 237785 Details for
Bug 343935
[JUnit] JUnit test case with customized Runner, can't locate the method when it contains parameters after running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to solve this issue (considering all comments)
patch_to_fix_bug_343935.txt (text/plain), 2.68 KB, created by
Andreas Schmid
on 2013-11-28 04:34:04 EST
(
hide
)
Description:
Patch to solve this issue (considering all comments)
Filename:
MIME Type:
Creator:
Andreas Schmid
Created:
2013-11-28 04:34:04 EST
Size:
2.68 KB
patch
obsolete
>From 31345d52dca1d05239bc4cbd8d5cc3476f7347e8 Mon Sep 17 00:00:00 2001 >From: Andreas Schmid <service@aaschmid.de> >Date: Thu, 7 Nov 2013 12:01:17 +0100 >Subject: [PATCH] fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=343935 > >--- > .../jdt/internal/junit/ui/OpenTestAction.java | 32 ++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > >diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/OpenTestAction.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/OpenTestAction.java >index 4d7e7ad..c6cf1ab 100644 >--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/OpenTestAction.java >+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/OpenTestAction.java >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.junit.ui; > >+import java.util.ArrayList; >+import java.util.List; > import java.util.regex.Matcher; > import java.util.regex.Pattern; > >@@ -24,6 +26,7 @@ import org.eclipse.ui.PlatformUI; > > import org.eclipse.ui.texteditor.ITextEditor; > >+import org.eclipse.jdt.core.IAnnotation; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.IMethod; >@@ -134,6 +137,35 @@ public class OpenTestAction extends OpenEditorAction { > IMethod method= type.getMethod(fMethodName, new String[0]); > if (method != null && method.exists()) > return method; >+ >+ // search just by name, if method not found yet (for custom runner with test methods having parameters) >+ try { >+ List<IMethod> foundMethods = new ArrayList<IMethod>(); >+ for (IMethod method2 : type.getMethods()) { >+ String methodName = method2.getElementName(); >+ IAnnotation methodAnnotation = method2.getAnnotation("Test"); >+ >+ // JUnit3 test method starts with "test" or JUnit4 test method is annotated with "@Test" >+ if (!(methodName.startsWith("test") || (methodAnnotation != null && methodAnnotation.exists()))) >+ continue; >+ >+ if (fMethodName.equals(methodName)) >+ foundMethods.add(method2); >+ } >+ if (foundMethods.isEmpty()) >+ return null; >+ else if (foundMethods.size() > 1) { >+ IMethod[] elements = foundMethods.toArray(new IMethod[foundMethods.size()]); >+ String title = ActionMessages.OpenAction_description; >+ String message = ActionMessages.OpenAction_select_element; >+ >+ return (IMethod) SelectionConverter.selectJavaElement(elements, getShell(), title, message); >+ } else >+ return foundMethods.get(0); >+ } catch (JavaModelException e) { >+ // if type does not exist or if an exception occurs while accessing its resource => ignore (no method found) >+ } >+ > return null; > } > >-- >1.8.3.4 (Apple Git-47) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
daniel_megert
:
review-
Actions:
View
|
Diff
Attachments on
bug 343935
:
194130
|
194133
|
194136
|
236753
|
237275
|
237784
|
237785
|
239978
|
241439
|
242044
|
242051
|
242054
|
242074