lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: svn commit: r1024305 - in /lucene/dev/trunk/solr/src/test/org/apache/solr/core: SolrCoreTest.java TestPropInjectDefaults.java
Date Wed, 20 Oct 2010 13:27:13 GMT
On Tue, Oct 19, 2010 at 12:24 PM, Uwe Schindler <uwe@thetaphi.de> wrote:
> Yonik,
>
> Just to reduce the work you have to do: With a subclass of LuceneTestCase, you don't
need to add @Test, as the internal test runner behaves like JUnit3 and runs all public methods
starting with "test" (in addition to @Test annotated,m which is still supported and used).
We did this, as a lot of tests were forgotten to be upgraded correctly. Now Lucene runs on
JUnit4 API (with static @BeforeClass and all nice stuff, @Ignore, assume*,...), but no test
had to be changed :-) Also LuceneTestCase extends Assert, so no static imports :-)
>

Well, just for thoroughness you might have to slightly change some
Junit3 tests (for example, ones on very old patches).
In most cases the junit3-style tests will work just fine, but there
are two cases where you will get a compile error:

1. Tests that have constructors like this:

public TestToken(String name) {
  super(name);
}

in this case just delete these useless constructors

2. Tests that have setUp or tearDown as protected (not public!)

protected void setUp() throws Exception {
  ...
}

in this case, these must be changed to public, since setUp() is public
in LuceneTestCase (and must be for the @Before to work).

If this is confusing, see
https://issues.apache.org/jira/browse/LUCENE-2642 for some examples of
tests that were changed in this way.

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


Mime
View raw message