We will release Lucene 3.0 very short after 2.9.1, which will be released in a few days. Lucene 3.0 is already almost finished (only some small Java 5 refactorings like varargs), but there is currently no need to rewrite the tests for 3.0. JUnit is working perfectly at the moment, in my opinion there is no need to convert all tests! There are more special testcase base classes in Lucene that need special handling, e.g. BaseTokenStreamTestCase (which tested TokenStreams with both old and new API in 2.9 and also provides asserts for TS contents), LocalizedTestCase (which tests in all Locales available, which is important for some analyzers or the QueryParser). These classes override runBare() to loop over the different Locales and so on. So lot's of hard work.
I would suggest to leave all test as they are, is there any important feature in JUnit 4 we could use? ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de _____ From: Erick Erickson [mailto:erickerick...@gmail.com] Sent: Thursday, November 05, 2009 10:24 AM To: java-dev@lucene.apache.org Subject: Re: Junit4 One other thing I thought of last night: Are there any objections to deprecating LuceneTestCase? I know we're trying to avoid deprecating things in 3.0, but since this isn't user-facing it seems reasonable. If it's deprecated, it'll at least give test writers a hint that junit4 is available (I'll include some pointers in the javadocs...)... Erick On Wed, Nov 4, 2009 at 9:07 PM, Erick Erickson <erickerick...@gmail.com> wrote: Now that we're going for Java 5, I took some time this evening to poke at using Junit4. I've done enough for proof of concept (POC), but before going further I wondered if there's enough interest or cautions or objections. It's actually not bad. I was afraid that we'd have to do an "all or none" conversion, but Junit3 and Junit4 co-exist quite happily both in IntelliJ and in ant. I managed to get all of the tests in ...test/org/apache/lucene/search/function to run under junit4, while all the rest of the tests are running under Junit3.... The short form is that I made a copy of LuceneTestCase called LuceneTestCaseJ4 that does NOT derive from TestCase but preserves (almost) all of the other functionality. There's some pesky nonsense with the constructor that takes a parameter (apparently disallowed by Junit4, and for POC I'm not going to worry about it, I'm not sure this is anything more than an artifact of Junit3 and can be removed). From there, it was just a matter of making the relevant test cases inherit from LuceneTestCaseJ4 and resolving some visibility issues (e.g. the setup and teardown (i.e. @Before and @After) in LTCJ4 had to be public), and resolving imports. I had to hack the common-build.xml a bit (warning, I'm no Ant expert) to include both junit jars, but that seems to work fine. So I *claim* that we can gradually migrate to junit4 if we want to without having to do a massive migration. I really haven't looked very carefully at the base LuceneTestCase class, but I can successfully comingle Junit3 and Junit4 testcases so I thought it was worth discussing. Note that I didn't do *anything* except get the tests to run. That is, other than adding things like @Before and @After and @Test, I didn't take advantage of any of the Junit4 features. If there's enough interest, I'll clean some things up, make a JIRA (I don't see anything in there already on this topic) and submit a patch in the next week. And this is *really* something I'd like someone else's eyes on.... Best Erick