You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/04/28 17:33:59 UTC

[GitHub] [maven-surefire] Tibor17 commented on pull request #349: Fix SUREFIRE-1910 - Missleading error message when using -Dtest=....

Tibor17 commented on pull request #349:
URL: https://github.com/apache/maven-surefire/pull/349#issuecomment-828643297


   IMO this method is illogical:
   ```
       private boolean getEffectiveFailIfNoTests()
       {
           if ( isSpecificTestSpecified() )
           {
               if ( getFailIfNoSpecifiedTests() != null )
               {
                   return getFailIfNoSpecifiedTests();
               }
               else if ( getFailIfNoTests() != null )
               {
                   return getFailIfNoTests();
               }
               else
               {
                   return true;
               }
           }
           else
           {
               return getFailIfNoTests() != null && getFailIfNoTests();
           }
       }
   ```
   and should be changed to something like this
   ```
       private boolean getEffectiveFailIfNoTests()
       {
           if ( isSpecificTestSpecified() )
           {
               if ( getFailIfNoTests() != null )
               {
                   return getFailIfNoTests();
               }
               else
               {
                   return true;
               }
           }
           else
           {
               if ( getFailIfNoSpecifiedTests() != null )
               {
                   return getFailIfNoSpecifiedTests();
               }
               return getFailIfNoTests() != null && getFailIfNoTests();
           }
       }
   ```
   WDYT?
   The methods `getFailIfNoSpecifiedTests` and `getFailIfNoTests` are also wrong and they should never return NULL, see the Javadoc about default values.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org