lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3762) Upgrade JUnit to 4.10, refactor state-machine of detecting setUp/tearDown call chaining.
Date Thu, 09 Feb 2012 09:55:00 GMT

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

Dawid Weiss commented on LUCENE-3762:
-------------------------------------

If we're changing JUnit perhaps it's worth upgrading the infrastructure a bit to make things
cleaner. I refactored all the hooks into a ruleset so that their nesting order is explicit:
{code}
  @Rule
  public final TestRule ruleChain = RuleChain
    .outerRule(new RememberThreadRule())
    .around(new TestResultInterceptorRule())
    .around(new InternalSetupTeardownRule())
    .around(new SubclassSetupTeardownRule());
{code}
So, subclasses (setup/teardown) run inside, surrounded by internal cleanups, surrounded by
test result tracker, surrounded by current thread remembering. I also removed _TestIgnoredException
in favor of a subclass of AssumptionIgnoredException - this removes some conditional checks
and unwinding code.

I added some tests to detect the expected behavior of LTC (what Robert mentioned); I would
feel great if we check that all the expectations are covered before we commit this in -- if
you can post a simple class along with: "this should result in this and that" I'll update
the tests. There are examples of such expectations in the patch (static classes and tests
inside TestSetupTeardownMethods class).
                
> Upgrade JUnit to 4.10, refactor state-machine of detecting setUp/tearDown call chaining.
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3762
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3762
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Dawid Weiss
>            Assignee: Dawid Weiss
>            Priority: Trivial
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3762.patch, LUCENE-3762.patch
>
>
> Both Lucene and Solr use JUnit 4.7. I suggest we move forward and upgrade to JUnit 4.10
which provides several infrastructural changes (serializable Description objects, class-level
rules, various tweaks). JUnit 4.10 also changes (or fixes, depends how you look at it) the
order in which @Before/@After hooks and @Rules are applied. This makes the old state-machine
in LuceneTestCase fail (because the order is changed).
> I rewrote the state machine and used a different, I think simpler, although Uwe may disagree
:), mechanism in which the hook methods setUp/ tearDown are still there, but they are empty
at the top level and serve only to detect whether subclasses chain super.setUp/tearDown properly
(if they override anything).
> In the long term, I would love to just get rid of public setup/teardown methods and make
them private (so that they cannot be overriden or even seen by subclasses) but this will require
changes to the runner itself.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message