[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616138#comment-14616138
 ] 

Raul Gutierrez Segales commented on ZOOKEEPER-2223:
---------------------------------------------------

Thanks for the patch [~suda]! It looks generally great, I only have two 
questions about:

{code}
+    public static List<FrameworkMethod> computeTestMethodsForClass(Class 
klass, List<FrameworkMethod> list) {
+        String methodName = System.getProperty("test.method");
+        if (methodName == null) {
+            LOG.info("No test.method specified");
+        } else {
+            LOG.info("Picked up test.method={}", methodName);
+            try {
+                list = Arrays.asList(new 
FrameworkMethod(klass.getMethod(methodName)));
+            } catch (NoSuchMethodException nsme) {
+                LOG.warn("{} does not have test.method={}. failing to default 
methods.", klass.getName(), methodName);
+            }
+        }
+        return list;
+    }
+
+
+    @Override
+    protected List<FrameworkMethod> computeTestMethods() {
+        return computeTestMethodsForClass(getTestClass().getJavaClass(), 
super.computeTestMethods());
+    }
{code}

Why is computeTestMethodsForClass static and public? Should it be not static 
and private/protected?

Also, the List<FrameworkMethod> list parameter in computeTestMethodsForClass is 
completely ignored and gets reassigned (and then used as the return value) 
which is confusing; could we use a different List<FrameworkMethod> variable for 
the return value to make it clear that the parameter is ignored on purpose 
(maybe name it ignored)?

After addressing these two things, I am happy to merge this. Thanks!

> support method-level JUnit testcase
> -----------------------------------
>
>                 Key: ZOOKEEPER-2223
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2223
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: tests
>            Reporter: Akihiro Suda
>            Assignee: Akihiro Suda
>            Priority: Minor
>         Attachments: ZOOKEEPER-2223-v2.patch, ZOOKEEPER-2223-v3.patch, 
> ZOOKEEPER-2223.patch
>
>
> Currently, a user can execute class-level single test, but cannot execute 
> method-level ones.
> This patch adds a support for method-level single test so as to facilitate 
> ease of debugging failing tests (like ZOOKEEPER-2080).
> Class-level test (exists in current version)
> {panel}
> $ ant -Dtestcase=ReconfigRecoveryTest test-core-java
> {panel}
> Method-level test (proposal)
> {panel}
> $ ant -Dtestcase=ReconfigRecoveryTest 
> -Dtest.method=testCurrentObserverIsParticipantInNewConfig test-core-java
> {panel}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to