Skip to content

Commit

Permalink
Sanitize failIfNoSpecifiedTests prefix in failsafe
Browse files Browse the repository at this point in the history
Surefire is using `surefire.failIfNoSpecifiedTests`,
but failsafe used `it.failIfNoSpecifiedTests`.
Error msg is then pointed to nonexistent property:
`No tests matching pattern "..." were executed! (Set
-Dfailsafe.failIfNoSpecifiedTests=false to ignore this error.)`
  • Loading branch information
liry authored and slawekjaranowski committed Feb 21, 2023
1 parent b8246dc commit 208eae2
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,24 @@ public class IntegrationTestMojo
private boolean useFile;

/**
* Set this to "true" to cause a failure if none of the tests specified in -Dtest=... are run. Defaults to
* Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
* "true".
*
* @since 2.12
* @deprecated Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead.
*/
@Deprecated
@Parameter( property = "it.failIfNoSpecifiedTests", defaultValue = "true" )
private boolean failIfNoSpecifiedTestsDeprecated;

/**
* Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to
* "true".
* Replacing "it.failIfNoSpecifiedTests" to be consistent with surefire plugin.
*
* @since 3.0.0-M8
*/
@Parameter( property = "failsafe.failIfNoSpecifiedTests", defaultValue = "true" )
private boolean failIfNoSpecifiedTests;

/**
Expand Down Expand Up @@ -899,9 +911,16 @@ public void setSystemPropertiesFile( File systemPropertiesFile )
}

@Override
@SuppressWarnings( "deprecation" )
public boolean getFailIfNoSpecifiedTests()
{
return failIfNoSpecifiedTests;
if ( !failIfNoSpecifiedTestsDeprecated )
{
getConsoleLogger().warning( "Use " + getPluginName()
+ ".failIfNoSpecifiedTests property instead of obsolete it.failIfNoSpecifiedTests." );
}
// since both have default "true", assuming that any "false" is set by user on purpose
return failIfNoSpecifiedTests && failIfNoSpecifiedTestsDeprecated;
}

@Override
Expand Down

0 comments on commit 208eae2

Please sign in to comment.