You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Slawomir Jaranowski (Jira)" <ji...@apache.org> on 2021/11/14 17:35:00 UTC

[jira] [Commented] (SUREFIRE-1621) package-private class/method supported in JUnit5 is not executed

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

Slawomir Jaranowski commented on SUREFIRE-1621:
-----------------------------------------------

Please verify with the 3.0.0-M5 version. I think it is working.

> package-private class/method supported in JUnit5 is not executed
> ----------------------------------------------------------------
>
>                 Key: SUREFIRE-1621
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1621
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support
>    Affects Versions: 3.0.0-M3
>         Environment: Java openJDK11, Maven 3.6.0
>            Reporter: Alex Chachanashvili
>            Priority: Major
>         Attachments: MavenJUnit5Test.tar.gz
>
>
> Test classes/methods have to be made pubic in order for maven/surefire to execute them.
>  
> Following will not execute (DebugTest.java) with surefire but will work with IntelliJ, eclipse, Gradle, etc that support JUnit5:
>  
> {code:java}
> class SampleTest {
>      @Test
>      void testAlwaysFails() { assertTrue(false); }
>  }{code}
>  
> However changing it to following will work with Surefire but cause IDEs to flag public scope that can be changed to package-private:
>  
> {code:java}
> public class SampleTest {
>      @Test
>      public void testAlwaysFails() { assertTrue(false); }
> } 
> {code}
>  
> JUnit 5 is supposed to support package-private declaration for test classes and test methods and IDEs like IntelliJ and eclipse are suggesting this, creating issues for people writing new tests that are not aware of the surefire anomaly.  Also automatic code cleanup in some IDEs are changing the tests to be package-private and causing them to no longer run.
>  
> Package-private tests are running correctly inside the IDEs and via Gradle, but being skipped with Maven+Surefire.
>  
> POM is basically a simple java project with test file, attached.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)