[jira] [Commented] (LUCENE-10662) Make LuceneTestCase not extending from org.junit.Assert
[ https://issues.apache.org/jira/browse/LUCENE-10662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17571453#comment-17571453 ] Marios Trivyzas commented on LUCENE-10662: -- {quote} I wouldn't rename any methods (assertEquals becomes assertEquality) - this will be even more confusing for downstream users. I'd remove the extend and assertEquals* methods from LuceneTestCase and move those methods into a separate class (like LuceneAssertions or something) - then the upgrade would be about importing them statically from junit's Assert or LuceneAssertions. {quote} I don't get how we can resolve a few issues: for example the *private void assertEquals(Sort a, Sort b)* in {*}TestSort{*}, if it remains like that and we also *import static org.junit.Assert.assertEquals* in the same class, the compiler doesn't know which one is using unless we use *Assert.assertEquals()* everwhere else, to actually use the junit one. The most important point is what you mentioned about all the projects that use {*}LuceneTestCase{*}, so let's see what other people also think about this. > Make LuceneTestCase not extending from org.junit.Assert > --- > > Key: LUCENE-10662 > URL: https://issues.apache.org/jira/browse/LUCENE-10662 > Project: Lucene - Core > Issue Type: Test > Components: general/test >Reporter: Marios Trivyzas >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > Since *LuceneTestCase* is a very useful abstract class that can be extended > and used by many projects, having it extending *org.junit.Assert* limits all > users to exclusively use the static methods of {*}org.junit.Assert{*}. In our > project we want to use [https://joel-costigliola.github.io/assertj] where the > main method to call is *org.assertj.core.api.Assertions.assertThat* which > conflicts with the deprecated {*}org.junit.Assert.assertThat{*}, recognized > by default by the compiler. So one can only use assertj if on every call uses > fully qualified name for the *assertThat* method, i.e. > > {code:java} > org.assertj.core.api.Assertions.assertThat(myObj.name()).isEqualTo(expectedName) > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org
[jira] [Commented] (LUCENE-10662) Make LuceneTestCase not extending from org.junit.Assert
[ https://issues.apache.org/jira/browse/LUCENE-10662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17571418#comment-17571418 ] Dawid Weiss commented on LUCENE-10662: -- Changing these methods will require a huge follow-up and cleanup in any other project that uses LuceneTestCase (and there are many). I don't think people will be happy with it (even though my heart is with you on assertj - I also prefer it to what's in hamcrest/junit). Even if people agree to change it, looking at the patch, I wouldn't rename any methods (assertEquals becomes assertEquality) - this will be even more confusing for downstream users. I'd remove the extend and assertEquals* methods from LuceneTestCase and move those methods into a separate class (like LuceneAssertions or something) - then the upgrade would be about importing them statically from junit's Assert or LuceneAssertions. Again, I'm not convinced this is a necessary improvement. I've lived with an explicit Assertions.* call from assertj - this is fine and explicit. And even used within Lucene code itself: [https://github.com/apache/lucene/blob/main/lucene/distribution.tests/src/test/org/apache/lucene/distribution/TestModularLayer.java#L117] > Make LuceneTestCase not extending from org.junit.Assert > --- > > Key: LUCENE-10662 > URL: https://issues.apache.org/jira/browse/LUCENE-10662 > Project: Lucene - Core > Issue Type: Test > Components: general/test >Reporter: Marios Trivyzas >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > Since *LuceneTestCase* is a very useful abstract class that can be extended > and used by many projects, having it extending *org.junit.Assert* limits all > users to exclusively use the static methods of {*}org.junit.Assert{*}. In our > project we want to use [https://joel-costigliola.github.io/assertj] where the > main method to call is *org.assertj.core.api.Assertions.assertThat* which > conflicts with the deprecated {*}org.junit.Assert.assertThat{*}, recognized > by default by the compiler. So one can only use assertj if on every call uses > fully qualified name for the *assertThat* method, i.e. > > {code:java} > org.assertj.core.api.Assertions.assertThat(myObj.name()).isEqualTo(expectedName) > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org