You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2010/09/13 13:19:32 UTC

[jira] Created: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

merge LuceneTestCase and LuceneTestCaseJ4
-----------------------------------------

                 Key: LUCENE-2642
                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
             Project: Lucene - Java
          Issue Type: Test
          Components: Tests
            Reporter: Robert Muir
             Fix For: 3.1, 4.0
         Attachments: LUCENE-2642.patch

We added Junit4 support, but as a separate test class.

So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
This creates a mess and is difficult to manage.

Instead, I propose a single base test class that works both junit3 and junit4 style.

I modified our LuceneTestCaseJ4 in the following way:
* the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
* of course, @Ignore works as expected everywhere.
* LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.

for most tests, no changes are required. but a few very minor things had to be changed:
* setUp() and tearDown() must be public, not protected.
* useless ctors must be removed, such as TestFoo(String name) { super(name); }
* LocalizedTestCase is gone, instead of
{code}
public class TestQueryParser extends LocalizedTestCase {
{code}
it is now
{code}
@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
public class TestQueryParser extends LuceneTestCase {
{code}
* Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}

I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.

I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir resolved LUCENE-2642.
---------------------------------

    Resolution: Fixed

OK i merged back all of Uwe's improvements. Thanks for the help Uwe.

I think now in future issues we can clean up and improve this test case a lot.
I felt discouraged from doing so with the previous duplication...

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642-fixes.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908739#action_12908739 ] 

Robert Muir commented on LUCENE-2642:
-------------------------------------

bq. I am just afraid of extending form the old JUnit Testcase.

we already extend this! Have you looked at LuceneTestCase lately?

bq. So extend Assert and the add missing static methods for compatibility.

Please, i would like to keep the epsilon stuff out of this issue. All tests pass the way it is now, there is no
problem.

We can fix epsilons in a followup issue, and then use no junit3 code at all... as I said its a great improvement, but not necessary to mix in with this change.

By doing both at once, if somethign goes wrong, it will be more difficult to debug. Lets keep the scope under control.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir updated LUCENE-2642:
--------------------------------

    Attachment: LUCENE-2642.patch

patch for core tests only, all tests pass.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908733#action_12908733 ] 

Uwe Schindler commented on LUCENE-2642:
---------------------------------------

Why not simply extend the Assert abstract class? This would remove use of deprecated old JUnit3 Framework completely?

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir updated LUCENE-2642:
--------------------------------

    Attachment: LUCENE-2642.patch

updated patch, with all of lucene/solr and including uwe's stuff.

all tests pass.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908736#action_12908736 ] 

Uwe Schindler commented on LUCENE-2642:
---------------------------------------

I am just afraid of extending form the old JUnit Testcase. We can simply add @Deprecated methods to asser floats without epsilon, that we can then remove.

So extend Assert and the add missing static methods for compatibility.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908733#action_12908733 ] 

Uwe Schindler edited comment on LUCENE-2642 at 9/13/10 8:02 AM:
----------------------------------------------------------------

Why not simply extend the org.junit.Assert class? This would remove use of deprecated old JUnit3 Framework completely?

      was (Author: thetaphi):
    Why not simply extend the Assert abstract class? This would remove use of deprecated old JUnit3 Framework completely?
  
> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908896#action_12908896 ] 

Robert Muir commented on LUCENE-2642:
-------------------------------------

OK, i didnt merge the reflection fixes yet, but i backported the patch to 3x.

Committed revision 996611, 996630 (3x).

Will mark the issue resolved when Uwe is out of reflection hell :)

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642-fixes.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908890#action_12908890 ] 

Robert Muir commented on LUCENE-2642:
-------------------------------------

thanks Uwe, i can merge this into the 3x backport too.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642-fixes.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2642:
----------------------------------

    Attachment: LUCENE-2642-fixes.patch

Some small fixes in reflection inspection:
- exclude static and abstract methods
- check native return type

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642-fixes.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908861#action_12908861 ] 

Uwe Schindler commented on LUCENE-2642:
---------------------------------------

Looks good, this is a really good step forwards. We can write old-style tests, butuse JUnit4 and can optionally add the @BeforeClass and so on :-)

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2642:
----------------------------------

    Attachment: LUCENE-2642-extendAssert.patch

Here the patch, so LuceneTestCaseJ4 only extends Assert without importing extra crap. The double/float API of old Junit3 is emulated using static overrides. After applying patch do a ant clean, else you will get lining errors.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908856#action_12908856 ] 

Michael McCandless commented on LUCENE-2642:
--------------------------------------------

This is great Robert!  Patch works for me (except for bizarre hang in Solr's TestSolrCoreProperties, apparently only on my machine, that's pre-existing).

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908866#action_12908866 ] 

Robert Muir commented on LUCENE-2642:
-------------------------------------

bq. We can write old-style tests, butuse JUnit4 and can optionally add the @BeforeClass and so on 

Yeah i've never understood why Junit4 requires all these static imports and annotations... i just care about @BeforeClass!


> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642-extendAssert.patch, LUCENE-2642.patch, LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2642) merge LuceneTestCase and LuceneTestCaseJ4

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908735#action_12908735 ] 

Robert Muir commented on LUCENE-2642:
-------------------------------------

bq. Why not simply extend the Assert abstract class? This would remove use of deprecated old JUnit3 Framework completely?

I would like to do this under a different issue.

We cannot do this, until all assertEquals(float, float) are changed to use epsilons, for example.

By extending Assert, we can catch all the places we don't use epsilons and fix them, which
is a great improvement, but out of scope of this issue.

> merge LuceneTestCase and LuceneTestCaseJ4
> -----------------------------------------
>
>                 Key: LUCENE-2642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2642
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: Tests
>            Reporter: Robert Muir
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2642.patch
>
>
> We added Junit4 support, but as a separate test class.
> So unfortunately, we have two separate base classes to maintain: LuceneTestCase and LuceneTestCaseJ4.
> This creates a mess and is difficult to manage.
> Instead, I propose a single base test class that works both junit3 and junit4 style.
> I modified our LuceneTestCaseJ4 in the following way:
> * the methods to run are not limited to the ones annotated with @Test, but also any void no-arg methods that start with "test", like junit3. this means you dont have to sprinkle @Test everywhere.
> * of course, @Ignore works as expected everywhere.
> * LuceneTestCaseJ4 extends TestCase so you dont have to import static Assert.* to get all the asserts.
> for most tests, no changes are required. but a few very minor things had to be changed:
> * setUp() and tearDown() must be public, not protected.
> * useless ctors must be removed, such as TestFoo(String name) { super(name); }
> * LocalizedTestCase is gone, instead of
> {code}
> public class TestQueryParser extends LocalizedTestCase {
> {code}
> it is now
> {code}
> @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
> public class TestQueryParser extends LuceneTestCase {
> {code}
> * Same with MultiCodecTestCase: (LuceneTestCase.MultiCodecTestCaseRunner.class}
> I only did the core tests in the patch as a start, and i just made an empty LuceneTestCase extends LuceneTestCaseJ4.
> I'd like to do contrib and solr and rename this LuceneTestCaseJ4 to only a single class: LuceneTestCase.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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