@Test public void shouldVerifyConfigParameters() throws Exception { Mojo mojo = new Mojo() { @Override public File getTestClassesDirectory() { return new File( System.getProperty( "user.dir" ), "target/test-classes" ); } @Override protected String getEnableProcessChecker() { return "fake"; } }; e.expect( MojoFailureException.class ); e.expectMessage( "Unexpected value 'fake' in the configuration parameter 'enableProcessChecker'." ); mojo.verifyParameters(); }
boolean verifyParameters() throws MojoFailureException, MojoExecutionException { setProperties( new SurefireProperties( getProperties() ) ); if ( isSkipExecution() ) { getConsoleLogger().info( "Tests are skipped." ); return false; } String jvmToUse = getJvm(); if ( toolchain != null ) { getConsoleLogger().info( "Toolchain in maven-" + getPluginName() + "-plugin: " + toolchain ); if ( jvmToUse != null ) { getConsoleLogger().warning( "Toolchains are ignored, 'jvm' parameter is set to " + jvmToUse ); } } if ( !getTestClassesDirectory().exists() && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) ) { if ( TRUE.equals( getFailIfNoTests() ) ) { throw new MojoFailureException( "No tests to run!" ); } getConsoleLogger().info( "No tests to run." ); } else { ensureEnableProcessChecker(); convertDeprecatedForkMode(); ensureWorkingDirectoryExists(); ensureParallelRunningCompatibility(); ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); warnIfRerunClashes(); warnIfWrongShutdownValue(); warnIfNotApplicableSkipAfterFailureCount(); warnIfIllegalTempDir(); warnIfForkCountIsZero(); printDefaultSeedIfNecessary(); } return true; }
AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters { boolean verifyParameters() throws MojoFailureException, MojoExecutionException { setProperties( new SurefireProperties( getProperties() ) ); if ( isSkipExecution() ) { getConsoleLogger().info( "Tests are skipped." ); return false; } String jvmToUse = getJvm(); if ( toolchain != null ) { getConsoleLogger().info( "Toolchain in maven-" + getPluginName() + "-plugin: " + toolchain ); if ( jvmToUse != null ) { getConsoleLogger().warning( "Toolchains are ignored, 'jvm' parameter is set to " + jvmToUse ); } } if ( !getTestClassesDirectory().exists() && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) ) { if ( TRUE.equals( getFailIfNoTests() ) ) { throw new MojoFailureException( "No tests to run!" ); } getConsoleLogger().info( "No tests to run." ); } else { ensureEnableProcessChecker(); convertDeprecatedForkMode(); ensureWorkingDirectoryExists(); ensureParallelRunningCompatibility(); ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); warnIfRerunClashes(); warnIfWrongShutdownValue(); warnIfNotApplicableSkipAfterFailureCount(); warnIfIllegalTempDir(); warnIfForkCountIsZero(); printDefaultSeedIfNecessary(); } return true; } }
AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters { boolean verifyParameters() throws MojoFailureException, MojoExecutionException { setProperties( new SurefireProperties( getProperties() ) ); if ( isSkipExecution() ) { getConsoleLogger().info( "Tests are skipped." ); return false; } String jvmToUse = getJvm(); if ( toolchain != null ) { getConsoleLogger().info( "Toolchain in maven-" + getPluginName() + "-plugin: " + toolchain ); if ( jvmToUse != null ) { getConsoleLogger().warning( "Toolchains are ignored, 'jvm' parameter is set to " + jvmToUse ); } } if ( !getTestClassesDirectory().exists() && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) ) { if ( TRUE.equals( getFailIfNoTests() ) ) { throw new MojoFailureException( "No tests to run!" ); } getConsoleLogger().info( "No tests to run." ); } else { ensureEnableProcessChecker(); convertDeprecatedForkMode(); ensureWorkingDirectoryExists(); ensureParallelRunningCompatibility(); ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); warnIfRerunClashes(); warnIfWrongShutdownValue(); warnIfNotApplicableSkipAfterFailureCount(); warnIfIllegalTempDir(); warnIfForkCountIsZero(); printDefaultSeedIfNecessary(); } return true; }  }
AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters { boolean verifyParameters() throws MojoFailureException, MojoExecutionException { setProperties( new SurefireProperties( getProperties() ) ); if ( isSkipExecution() ) { getConsoleLogger().info( "Tests are skipped." ); return false; } String jvmToUse = getJvm(); if ( toolchain != null ) { getConsoleLogger().info( "Toolchain in maven-" + getPluginName() + "-plugin: " + toolchain ); if ( jvmToUse != null ) { getConsoleLogger().warning( "Toolchains are ignored, 'jvm' parameter is set to " + jvmToUse ); } } if ( !getTestClassesDirectory().exists() && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) ) { if ( TRUE.equals( getFailIfNoTests() ) ) { throw new MojoFailureException( "No tests to run!" ); } getConsoleLogger().info( "No tests to run." ); } else { ensureEnableProcessChecker(); convertDeprecatedForkMode(); ensureWorkingDirectoryExists(); ensureParallelRunningCompatibility(); ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); warnIfRerunClashes(); warnIfWrongShutdownValue(); warnIfNotApplicableSkipAfterFailureCount(); warnIfIllegalTempDir(); warnIfForkCountIsZero(); printDefaultSeedIfNecessary(); } return true; }  @Override abstract List<String> getIncludes(); abstract File getIncludesFile(); @Override abstract void setIncludes( List<String> includes ); abstract File getExcludesFile(); abstract File[] getSuiteXmlFiles(); abstract void setSuiteXmlFiles( File[] suiteXmlFiles ); abstract String getRunOrder(); abstract void setRunOrder( String runOrder ); abstract Long getRunOrderRandomSeed(); abstract void setRunOrderRandomSeed( Long runOrderRandomSeed ); @Override void execute(); static SurefireProperties createCopyAndReplaceForkNumPlaceholder(
        SurefireProperties effectiveSystemProperties, int threadNumber ); RepositorySystem getRepositorySystem(); void setRepositorySystem( RepositorySystem repositorySystem ); DependencyResolver getDependencyResolver(); void setDependencyResolver( DependencyResolver dependencyResolver ); TestListResolver getSpecificTests(); @Override List<String> getExcludes(); @Override void setExcludes( List<String> excludes ); @Override ArtifactRepository getLocalRepository(); @Override void setLocalRepository( ArtifactRepository localRepository ); Properties getSystemProperties(); @SuppressWarnings( "UnusedDeclaration" ) void setSystemProperties( Properties systemProperties ); Map<String, String> getSystemPropertyVariables(); @SuppressWarnings( "UnusedDeclaration" ) void setSystemPropertyVariables( Map<String, String> systemPropertyVariables ); abstract File getSystemPropertiesFile(); @SuppressWarnings( "UnusedDeclaration" ) abstract void setSystemPropertiesFile( File systemPropertiesFile ); void setProperties( Properties properties ); Map<String, Artifact> getPluginArtifactMap(); @SuppressWarnings( "UnusedDeclaration" ) void setPluginArtifactMap( Map<String, Artifact> pluginArtifactMap ); Map<String, Artifact> getProjectArtifactMap(); @SuppressWarnings( "UnusedDeclaration" ) void setProjectArtifactMap( Map<String, Artifact> projectArtifactMap ); String getReportNameSuffix(); @SuppressWarnings( "UnusedDeclaration" ) void setReportNameSuffix( String reportNameSuffix ); boolean isRedirectTestOutputToFile(); @SuppressWarnings( "UnusedDeclaration" ) void setRedirectTestOutputToFile( boolean redirectTestOutputToFile ); Boolean getFailIfNoTests(); void setFailIfNoTests( boolean failIfNoTests ); String getForkMode(); @SuppressWarnings( "UnusedDeclaration" ) void setForkMode( String forkMode ); String getJvm(); String getArgLine(); @SuppressWarnings( "UnusedDeclaration" ) void setArgLine( String argLine ); Map<String, String> getEnvironmentVariables(); @SuppressWarnings( "UnusedDeclaration" ) void setEnvironmentVariables( Map<String, String> environmentVariables ); File getWorkingDirectory(); @SuppressWarnings( "UnusedDeclaration" ) void setWorkingDirectory( File workingDirectory ); boolean isChildDelegation(); @SuppressWarnings( "UnusedDeclaration" ) void setChildDelegation( boolean childDelegation ); String getGroups(); @SuppressWarnings( "UnusedDeclaration" ) void setGroups( String groups ); String getExcludedGroups(); @SuppressWarnings( "UnusedDeclaration" ) void setExcludedGroups( String excludedGroups ); String getJunitArtifactName(); @SuppressWarnings( "UnusedDeclaration" ) void setJunitArtifactName( String junitArtifactName ); String getTestNGArtifactName(); @SuppressWarnings( "UnusedDeclaration" ) void setTestNGArtifactName( String testNGArtifactName ); int getThreadCount(); @SuppressWarnings( "UnusedDeclaration" ) void setThreadCount( int threadCount ); boolean getPerCoreThreadCount(); @SuppressWarnings( "UnusedDeclaration" ) void setPerCoreThreadCount( boolean perCoreThreadCount ); boolean getUseUnlimitedThreads(); @SuppressWarnings( "UnusedDeclaration" ) void setUseUnlimitedThreads( boolean useUnlimitedThreads ); String getParallel(); @SuppressWarnings( "UnusedDeclaration" ) void setParallel( String parallel ); boolean isParallelOptimized(); @SuppressWarnings( "UnusedDeclaration" ) void setParallelOptimized( boolean parallelOptimized ); int getThreadCountSuites(); void setThreadCountSuites( int threadCountSuites ); int getThreadCountClasses(); void setThreadCountClasses( int threadCountClasses ); int getThreadCountMethods(); void setThreadCountMethods( int threadCountMethods ); boolean isTrimStackTrace(); @SuppressWarnings( "UnusedDeclaration" ) void setTrimStackTrace( boolean trimStackTrace ); List<ArtifactRepository> getProjectRemoteRepositories(); @SuppressWarnings( "UnusedDeclaration" ) void setProjectRemoteRepositories( List<ArtifactRepository> projectRemoteRepositories ); List<ArtifactRepository> getRemoteRepositories(); @SuppressWarnings( "UnusedDeclaration" ) void setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); boolean isDisableXmlReport(); @SuppressWarnings( "UnusedDeclaration" ) void setDisableXmlReport( boolean disableXmlReport ); boolean isEnableAssertions(); boolean effectiveIsEnableAssertions(); @SuppressWarnings( "UnusedDeclaration" ) void setEnableAssertions( boolean enableAssertions ); MavenSession getSession(); @SuppressWarnings( "UnusedDeclaration" ) void setSession( MavenSession session ); String getObjectFactory(); @SuppressWarnings( "UnusedDeclaration" ) void setObjectFactory( String objectFactory ); ToolchainManager getToolchainManager(); @SuppressWarnings( "UnusedDeclaration" ) void setToolchainManager( ToolchainManager toolchainManager ); boolean isMavenParallel(); String[] getDependenciesToScan(); void setDependenciesToScan( String[] dependenciesToScan ); PluginDescriptor getPluginDescriptor(); MavenProject getProject(); @SuppressWarnings( "UnusedDeclaration" ) void setProject( MavenProject project ); @Override File getTestSourceDirectory(); @Override void setTestSourceDirectory( File testSourceDirectory ); String getForkCount(); boolean isReuseForks(); String[] getAdditionalClasspathElements(); void setAdditionalClasspathElements( String[] additionalClasspathElements ); String[] getClasspathDependencyExcludes(); void setClasspathDependencyExcludes( String[] classpathDependencyExcludes ); String getClasspathDependencyScopeExclude(); void setClasspathDependencyScopeExclude( String classpathDependencyScopeExclude ); File getProjectBuildDirectory(); void setProjectBuildDirectory( File projectBuildDirectory ); Map<String, String> getJdkToolchain(); void setJdkToolchain( Map<String, String> jdkToolchain ); String getTempDir(); void setTempDir( String tempDir ); }
AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters { boolean verifyParameters() throws MojoFailureException, MojoExecutionException { setProperties( new SurefireProperties( getProperties() ) ); if ( isSkipExecution() ) { getConsoleLogger().info( "Tests are skipped." ); return false; } String jvmToUse = getJvm(); if ( toolchain != null ) { getConsoleLogger().info( "Toolchain in maven-" + getPluginName() + "-plugin: " + toolchain ); if ( jvmToUse != null ) { getConsoleLogger().warning( "Toolchains are ignored, 'jvm' parameter is set to " + jvmToUse ); } } if ( !getTestClassesDirectory().exists() && ( getDependenciesToScan() == null || getDependenciesToScan().length == 0 ) ) { if ( TRUE.equals( getFailIfNoTests() ) ) { throw new MojoFailureException( "No tests to run!" ); } getConsoleLogger().info( "No tests to run." ); } else { ensureEnableProcessChecker(); convertDeprecatedForkMode(); ensureWorkingDirectoryExists(); ensureParallelRunningCompatibility(); ensureThreadCountWithPerThread(); warnIfUselessUseSystemClassLoaderParameter(); warnIfDefunctGroupsCombinations(); warnIfRerunClashes(); warnIfWrongShutdownValue(); warnIfNotApplicableSkipAfterFailureCount(); warnIfIllegalTempDir(); warnIfForkCountIsZero(); printDefaultSeedIfNecessary(); } return true; }  @Override abstract List<String> getIncludes(); abstract File getIncludesFile(); @Override abstract void setIncludes( List<String> includes ); abstract File getExcludesFile(); abstract File[] getSuiteXmlFiles(); abstract void setSuiteXmlFiles( File[] suiteXmlFiles ); abstract String getRunOrder(); abstract void setRunOrder( String runOrder ); abstract Long getRunOrderRandomSeed(); abstract void setRunOrderRandomSeed( Long runOrderRandomSeed ); @Override void execute(); static SurefireProperties createCopyAndReplaceForkNumPlaceholder(
        SurefireProperties effectiveSystemProperties, int threadNumber ); RepositorySystem getRepositorySystem(); void setRepositorySystem( RepositorySystem repositorySystem ); DependencyResolver getDependencyResolver(); void setDependencyResolver( DependencyResolver dependencyResolver ); TestListResolver getSpecificTests(); @Override List<String> getExcludes(); @Override void setExcludes( List<String> excludes ); @Override ArtifactRepository getLocalRepository(); @Override void setLocalRepository( ArtifactRepository localRepository ); Properties getSystemProperties(); @SuppressWarnings( "UnusedDeclaration" ) void setSystemProperties( Properties systemProperties ); Map<String, String> getSystemPropertyVariables(); @SuppressWarnings( "UnusedDeclaration" ) void setSystemPropertyVariables( Map<String, String> systemPropertyVariables ); abstract File getSystemPropertiesFile(); @SuppressWarnings( "UnusedDeclaration" ) abstract void setSystemPropertiesFile( File systemPropertiesFile ); void setProperties( Properties properties ); Map<String, Artifact> getPluginArtifactMap(); @SuppressWarnings( "UnusedDeclaration" ) void setPluginArtifactMap( Map<String, Artifact> pluginArtifactMap ); Map<String, Artifact> getProjectArtifactMap(); @SuppressWarnings( "UnusedDeclaration" ) void setProjectArtifactMap( Map<String, Artifact> projectArtifactMap ); String getReportNameSuffix(); @SuppressWarnings( "UnusedDeclaration" ) void setReportNameSuffix( String reportNameSuffix ); boolean isRedirectTestOutputToFile(); @SuppressWarnings( "UnusedDeclaration" ) void setRedirectTestOutputToFile( boolean redirectTestOutputToFile ); Boolean getFailIfNoTests(); void setFailIfNoTests( boolean failIfNoTests ); String getForkMode(); @SuppressWarnings( "UnusedDeclaration" ) void setForkMode( String forkMode ); String getJvm(); String getArgLine(); @SuppressWarnings( "UnusedDeclaration" ) void setArgLine( String argLine ); Map<String, String> getEnvironmentVariables(); @SuppressWarnings( "UnusedDeclaration" ) void setEnvironmentVariables( Map<String, String> environmentVariables ); File getWorkingDirectory(); @SuppressWarnings( "UnusedDeclaration" ) void setWorkingDirectory( File workingDirectory ); boolean isChildDelegation(); @SuppressWarnings( "UnusedDeclaration" ) void setChildDelegation( boolean childDelegation ); String getGroups(); @SuppressWarnings( "UnusedDeclaration" ) void setGroups( String groups ); String getExcludedGroups(); @SuppressWarnings( "UnusedDeclaration" ) void setExcludedGroups( String excludedGroups ); String getJunitArtifactName(); @SuppressWarnings( "UnusedDeclaration" ) void setJunitArtifactName( String junitArtifactName ); String getTestNGArtifactName(); @SuppressWarnings( "UnusedDeclaration" ) void setTestNGArtifactName( String testNGArtifactName ); int getThreadCount(); @SuppressWarnings( "UnusedDeclaration" ) void setThreadCount( int threadCount ); boolean getPerCoreThreadCount(); @SuppressWarnings( "UnusedDeclaration" ) void setPerCoreThreadCount( boolean perCoreThreadCount ); boolean getUseUnlimitedThreads(); @SuppressWarnings( "UnusedDeclaration" ) void setUseUnlimitedThreads( boolean useUnlimitedThreads ); String getParallel(); @SuppressWarnings( "UnusedDeclaration" ) void setParallel( String parallel ); boolean isParallelOptimized(); @SuppressWarnings( "UnusedDeclaration" ) void setParallelOptimized( boolean parallelOptimized ); int getThreadCountSuites(); void setThreadCountSuites( int threadCountSuites ); int getThreadCountClasses(); void setThreadCountClasses( int threadCountClasses ); int getThreadCountMethods(); void setThreadCountMethods( int threadCountMethods ); boolean isTrimStackTrace(); @SuppressWarnings( "UnusedDeclaration" ) void setTrimStackTrace( boolean trimStackTrace ); List<ArtifactRepository> getProjectRemoteRepositories(); @SuppressWarnings( "UnusedDeclaration" ) void setProjectRemoteRepositories( List<ArtifactRepository> projectRemoteRepositories ); List<ArtifactRepository> getRemoteRepositories(); @SuppressWarnings( "UnusedDeclaration" ) void setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); boolean isDisableXmlReport(); @SuppressWarnings( "UnusedDeclaration" ) void setDisableXmlReport( boolean disableXmlReport ); boolean isEnableAssertions(); boolean effectiveIsEnableAssertions(); @SuppressWarnings( "UnusedDeclaration" ) void setEnableAssertions( boolean enableAssertions ); MavenSession getSession(); @SuppressWarnings( "UnusedDeclaration" ) void setSession( MavenSession session ); String getObjectFactory(); @SuppressWarnings( "UnusedDeclaration" ) void setObjectFactory( String objectFactory ); ToolchainManager getToolchainManager(); @SuppressWarnings( "UnusedDeclaration" ) void setToolchainManager( ToolchainManager toolchainManager ); boolean isMavenParallel(); String[] getDependenciesToScan(); void setDependenciesToScan( String[] dependenciesToScan ); PluginDescriptor getPluginDescriptor(); MavenProject getProject(); @SuppressWarnings( "UnusedDeclaration" ) void setProject( MavenProject project ); @Override File getTestSourceDirectory(); @Override void setTestSourceDirectory( File testSourceDirectory ); String getForkCount(); boolean isReuseForks(); String[] getAdditionalClasspathElements(); void setAdditionalClasspathElements( String[] additionalClasspathElements ); String[] getClasspathDependencyExcludes(); void setClasspathDependencyExcludes( String[] classpathDependencyExcludes ); String getClasspathDependencyScopeExclude(); void setClasspathDependencyScopeExclude( String classpathDependencyScopeExclude ); File getProjectBuildDirectory(); void setProjectBuildDirectory( File projectBuildDirectory ); Map<String, String> getJdkToolchain(); void setJdkToolchain( Map<String, String> jdkToolchain ); String getTempDir(); void setTempDir( String tempDir );  }