You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/06/10 11:10:29 UTC
[maven-surefire] branch master updated: fixed mvn site and javadoc
report before Version 2.22.0
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new c455894 fixed mvn site and javadoc report before Version 2.22.0
c455894 is described below
commit c4558944a83ddefb862d8d89bb9d95d82171f9ec
Author: Tibor17 <ti...@apache.org>
AuthorDate: Sun Jun 10 13:10:07 2018 +0200
fixed mvn site and javadoc report before Version 2.22.0
---
.../src/site/apt/examples/junit-platform.apt.vm | 6 +-
pom.xml | 9 +-
src/site/site.xml | 14 +-
surefire-providers/surefire-junit-platform/pom.xml | 1 -
.../junitplatform/JUnitPlatformProviderTests.java | 94 +++++-----
...apterTests.java => RunListenerAdapterTest.java} | 197 +++++++++------------
...dFilterTests.java => TestMethodFilterTest.java} | 13 +-
...erTests.java => TestPlanScannerFilterTest.java} | 29 ++-
8 files changed, 163 insertions(+), 200 deletions(-)
diff --git a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm
index d65ca74..670dd56 100644
--- a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm
@@ -143,11 +143,11 @@ else
* Filtering by Tags
-You can use JUnit5 Tags and filter tests by tags or tag expressions.
+ You can use JUnit5 Tags and filter tests by tags or tag expressions.
- * to include <<<tags>>> or <<<tag expressions>>>, use <<<groups>>>.
+ * To include <<<tags>>> or <<<tag expressions>>>, use <<<groups>>>.
- * to exclude <<<tags>>> or <<<tag expressions>>>, use either <<<excludedGroups>>>.
+ * To exclude <<<tags>>> or <<<tag expressions>>>, use either <<<excludedGroups>>>.
+---+
...
diff --git a/pom.xml b/pom.xml
index abed302..ded6952 100644
--- a/pom.xml
+++ b/pom.xml
@@ -312,6 +312,11 @@
<version>1.4</version>
</dependency>
<dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.9.1</version>
+ </dependency>
+ <dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>2.0.3</version>
@@ -404,7 +409,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.15</version>
+ <version>1.16</version>
<executions>
<execution>
<id>signature-check</id>
@@ -472,7 +477,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>3.4</version>
+ <version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
diff --git a/src/site/site.xml b/src/site/site.xml
index ae5f691..447f71b 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -33,7 +33,7 @@
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
- <version>1.3.0</version>
+ <version>1.7</version>
</skin>
<custom>
@@ -63,10 +63,14 @@
<menu ref="reports" inherit="bottom"/>
<footer>
- <div class="row pull-left">Apache ${project.name}, ${project.name}, Apache, the Apache feather logo, and the Apache ${project.name} project logos are trademarks of The Apache Software Foundation.</div>
- <div class="row pull-left">
- <a href="${project.url}privacy-policy.html">Privacy Policy</a>
- </div>
+ <![CDATA[
+ <div class="row pull-left">
+ <p>Apache ${project.name}, ${project.name}, Apache, the Apache feather logo, and the Apache ${project.name} project logos are trademarks of The Apache Software Foundation.</p>
+ </div>
+ <div class="row pull-left">
+ <a href="${project.url}privacy-policy.html">Privacy Policy</a>
+ </div>
+ ]]>
</footer>
</body>
</project>
diff --git a/surefire-providers/surefire-junit-platform/pom.xml b/surefire-providers/surefire-junit-platform/pom.xml
index 21bc2ec..d8d025b 100644
--- a/surefire-providers/surefire-junit-platform/pom.xml
+++ b/surefire-providers/surefire-junit-platform/pom.xml
@@ -104,7 +104,6 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
- <version>3.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProviderTests.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProviderTests.java
index 6ae42a6..4194daa 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProviderTests.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProviderTests.java
@@ -60,8 +60,8 @@ import org.apache.maven.surefire.testset.TestSetFailedException;
import org.apache.maven.surefire.util.RunOrderCalculator;
import org.apache.maven.surefire.util.ScanResult;
import org.apache.maven.surefire.util.TestsToRun;
+import org.junit.Test;
import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
import org.junit.platform.launcher.Launcher;
import org.junit.platform.launcher.TestIdentifier;
import org.junit.platform.launcher.TestPlan;
@@ -77,21 +77,20 @@ import org.mockito.InOrder;
*
* @since 2.22.0
*/
-class JUnitPlatformProviderTests
+public class JUnitPlatformProviderTests
{
@Test
- void getSuitesReturnsScannedClasses()
+ public void getSuitesReturnsScannedClasses()
{
- ProviderParameters providerParameters =
- providerParametersMock( TestClass1.class, TestClass2.class );
+ ProviderParameters providerParameters = providerParametersMock( TestClass1.class, TestClass2.class );
JUnitPlatformProvider provider = new JUnitPlatformProvider( providerParameters );
-
- assertThat( provider.getSuites() ).containsOnly( TestClass1.class, TestClass2.class );
+ assertThat( provider.getSuites() )
+ .containsOnly( TestClass1.class, TestClass2.class );
}
@Test
- void invokeThrowsForWrongForkTestSet()
+ public void invokeThrowsForWrongForkTestSet()
{
ProviderParameters providerParameters = providerParametersMock( Integer.class );
JUnitPlatformProvider provider = new JUnitPlatformProvider( providerParameters );
@@ -100,7 +99,7 @@ class JUnitPlatformProviderTests
}
@Test
- void allGivenTestsToRunAreInvoked()
+ public void allGivenTestsToRunAreInvoked()
throws Exception
{
Launcher launcher = LauncherFactory.create();
@@ -127,7 +126,7 @@ class JUnitPlatformProviderTests
}
@Test
- void singleTestClassIsInvoked()
+ public void singleTestClassIsInvoked()
throws Exception
{
Launcher launcher = LauncherFactory.create();
@@ -149,7 +148,7 @@ class JUnitPlatformProviderTests
}
@Test
- void allDiscoveredTestsAreInvokedForNullArgument()
+ public void allDiscoveredTestsAreInvokedForNullArgument()
throws Exception
{
RunListener runListener = runListenerMock();
@@ -204,7 +203,7 @@ class JUnitPlatformProviderTests
}
@Test
- void outputIsCaptured()
+ public void outputIsCaptured()
throws Exception
{
Launcher launcher = LauncherFactory.create();
@@ -226,7 +225,7 @@ class JUnitPlatformProviderTests
}
@Test
- void onlyGroupsIsDeclared()
+ public void onlyGroupsIsDeclared()
{
Map<String, String> properties = singletonMap( TESTNG_GROUPS_PROP, "groupOne, groupTwo" );
@@ -239,7 +238,7 @@ class JUnitPlatformProviderTests
}
@Test
- void onlyExcludeTagsIsDeclared()
+ public void onlyExcludeTagsIsDeclared()
{
Map<String, String> properties = singletonMap( TESTNG_EXCLUDEDGROUPS_PROP, "tagOne, tagTwo" );
@@ -252,7 +251,7 @@ class JUnitPlatformProviderTests
}
@Test
- void noFiltersAreCreatedIfTagsAreEmpty()
+ public void noFiltersAreCreatedIfTagsAreEmpty()
{
Map<String, String> properties = singletonMap( TESTNG_GROUPS_PROP, "" );
@@ -264,7 +263,7 @@ class JUnitPlatformProviderTests
}
@Test
- void filtersWithEmptyTagsAreNotRegistered()
+ public void filtersWithEmptyTagsAreNotRegistered()
{
// Here only tagOne is registered as a valid tag and other tags are ignored as they are empty
Map<String, String> properties = singletonMap( TESTNG_EXCLUDEDGROUPS_PROP, "tagOne," );
@@ -277,7 +276,7 @@ class JUnitPlatformProviderTests
}
@Test
- void bothIncludeAndExcludeAreAllowed()
+ public void bothIncludeAndExcludeAreAllowed()
{
Map<String, String> properties = new HashMap<>();
properties.put( TESTNG_GROUPS_PROP, "tagOne, tagTwo" );
@@ -292,7 +291,7 @@ class JUnitPlatformProviderTests
}
@Test
- void tagExpressionsAreSupportedForIncludeTagsContainingVerticalBar()
+ public void tagExpressionsAreSupportedForIncludeTagsContainingVerticalBar()
{
Map<String, String> properties = new HashMap<>();
properties.put( TESTNG_GROUPS_PROP, "tagOne | tagTwo" );
@@ -307,7 +306,7 @@ class JUnitPlatformProviderTests
}
@Test
- void tagExpressionsAreSupportedForIncludeTagsContainingAmpersand()
+ public void tagExpressionsAreSupportedForIncludeTagsContainingAmpersand()
{
Map<String, String> properties = new HashMap<>();
properties.put( TESTNG_GROUPS_PROP, "tagOne & !tagTwo" );
@@ -322,7 +321,7 @@ class JUnitPlatformProviderTests
}
@Test
- void noFiltersAreCreatedIfNoPropertiesAreDeclared()
+ public void noFiltersAreCreatedIfNoPropertiesAreDeclared()
{
ProviderParameters providerParameters = providerParametersMock( TestClass1.class );
@@ -332,7 +331,7 @@ class JUnitPlatformProviderTests
}
@Test
- void defaultConfigurationParametersAreEmpty()
+ public void defaultConfigurationParametersAreEmpty()
{
ProviderParameters providerParameters = providerParametersMock( TestClass1.class );
when( providerParameters.getProviderProperties() ).thenReturn( emptyMap() );
@@ -343,7 +342,7 @@ class JUnitPlatformProviderTests
}
@Test
- void parsesConfigurationParameters()
+ public void parsesConfigurationParameters()
{
ProviderParameters providerParameters = providerParametersMock( TestClass1.class );
when( providerParameters.getProviderProperties() )
@@ -360,7 +359,7 @@ class JUnitPlatformProviderTests
}
@Test
- void executesSingleTestIncludedByName()
+ public void executesSingleTestIncludedByName()
throws Exception
{
// following is equivalent of adding '-Dtest=TestClass3#prefix1Suffix1'
@@ -371,7 +370,7 @@ class JUnitPlatformProviderTests
}
@Test
- void executesMultipleTestsIncludedByName()
+ public void executesMultipleTestsIncludedByName()
throws Exception
{
// following is equivalent of adding '-Dtest=TestClass3#prefix1Suffix1+prefix2Suffix1'
@@ -383,7 +382,7 @@ class JUnitPlatformProviderTests
}
@Test
- void executesMultipleTestsIncludedByNamePattern()
+ public void executesMultipleTestsIncludedByNamePattern()
throws Exception
{
// following is equivalent of adding '-Dtest=TestClass3#prefix1*'
@@ -395,7 +394,7 @@ class JUnitPlatformProviderTests
}
@Test
- void executesMultipleTestsIncludedByNamePatternWithQuestionMark()
+ public void executesMultipleTestsIncludedByNamePatternWithQuestionMark()
throws Exception
{
// following is equivalent of adding '-Dtest=TestClass3#prefix?Suffix2'
@@ -407,7 +406,7 @@ class JUnitPlatformProviderTests
}
@Test
- void doesNotExecuteTestsExcludedByName()
+ public void doesNotExecuteTestsExcludedByName()
throws Exception
{
// following is equivalent of adding '-Dtest=!TestClass3#prefix1Suffix2'
@@ -419,7 +418,7 @@ class JUnitPlatformProviderTests
}
@Test
- void doesNotExecuteTestsExcludedByNamePattern()
+ public void doesNotExecuteTestsExcludedByNamePattern()
throws Exception
{
// following is equivalent of adding '-Dtest=!TestClass3#prefix2*'
@@ -506,12 +505,11 @@ class JUnitPlatformProviderTests
private static Set<String> failedTestDisplayNames( TestExecutionSummary summary )
{
// @formatter:off
- return summary
- .getFailures()
- .stream()
- .map( Failure::getTestIdentifier )
- .map( TestIdentifier::getDisplayName )
- .collect( toSet() );
+ return summary.getFailures()
+ .stream()
+ .map( Failure::getTestIdentifier )
+ .map( TestIdentifier::getDisplayName )
+ .collect( toSet() );
// @formatter:on
}
@@ -571,23 +569,23 @@ class JUnitPlatformProviderTests
static final int TESTS_FAILED = 1;
- @Test
+ @org.junit.jupiter.api.Test
void test1()
{
}
- @Test
+ @org.junit.jupiter.api.Test
void test2()
{
}
@Disabled
- @Test
+ @org.junit.jupiter.api.Test
void test3()
{
}
- @Test
+ @org.junit.jupiter.api.Test
void test4()
{
throw new RuntimeException();
@@ -609,18 +607,18 @@ class JUnitPlatformProviderTests
static final int TESTS_FAILED = 1;
- @Test
+ @org.junit.jupiter.api.Test
void test1()
{
}
- @Test
+ @org.junit.jupiter.api.Test
void test2()
{
throw new RuntimeException();
}
- @Test
+ @org.junit.jupiter.api.Test
void test3()
{
assumeTrue( false );
@@ -629,7 +627,7 @@ class JUnitPlatformProviderTests
static class VerboseTestClass
{
- @Test
+ @org.junit.jupiter.api.Test
void test()
{
System.out.println( "stdout" );
@@ -638,7 +636,7 @@ class JUnitPlatformProviderTests
}
@Test
- void usesClassNamesForXmlReport()
+ public void usesClassNamesForXmlReport()
throws TestSetFailedException
{
String[] classNames = { Sub1Tests.class.getName(), Sub2Tests.class.getName() };
@@ -661,7 +659,7 @@ class JUnitPlatformProviderTests
static class AbstractTestClass
{
- @Test
+ @org.junit.jupiter.api.Test
void test()
{
}
@@ -679,25 +677,25 @@ class JUnitPlatformProviderTests
static class TestClass3
{
- @Test
+ @org.junit.jupiter.api.Test
void prefix1Suffix1()
{
throw new RuntimeException();
}
- @Test
+ @org.junit.jupiter.api.Test
void prefix2Suffix1()
{
throw new RuntimeException();
}
- @Test
+ @org.junit.jupiter.api.Test
void prefix1Suffix2()
{
throw new RuntimeException();
}
- @Test
+ @org.junit.jupiter.api.Test
void prefix2Suffix2()
{
throw new RuntimeException();
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTests.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
similarity index 72%
rename from surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTests.java
rename to surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
index 97f6ffc..0cf526c 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTests.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
@@ -21,10 +21,13 @@ package org.apache.maven.surefire.junitplatform;
import static java.util.Collections.emptyList;
import static java.util.Collections.singleton;
+import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.platform.engine.TestDescriptor.Type.CONTAINER;
+import static org.junit.platform.engine.TestDescriptor.Type.TEST;
import static org.junit.platform.engine.TestExecutionResult.successful;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.inOrder;
@@ -35,15 +38,14 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import java.util.Collections;
import java.util.Optional;
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.RunListener;
import org.apache.maven.surefire.report.SimpleReportEntry;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.Before;
+import org.junit.Test;
import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Test;
import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.platform.engine.TestDescriptor;
@@ -64,15 +66,14 @@ import org.mockito.InOrder;
*
* @since 2.22.0
*/
-class RunListenerAdapterTests
+public class RunListenerAdapterTest
{
-
private RunListener listener;
private RunListenerAdapter adapter;
- @BeforeEach
- void setUp()
+ @Before
+ public void setUp()
{
listener = mock( RunListener.class );
adapter = new RunListenerAdapter( listener );
@@ -80,17 +81,16 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWithCorrectNamesWhenMethodExecutionStarted()
+ public void notifiedWithCorrectNamesWhenMethodExecutionStarted()
throws Exception
{
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
- TestPlan testPlan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
+ TestPlan testPlan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
adapter.testPlanExecutionStarted( testPlan );
TestIdentifier methodIdentifier =
- identifiersAsParentOnTestPlan( testPlan, newClassDescriptor(), newMethodDescriptor() );
+ identifiersAsParentOnTestPlan( testPlan, newClassDescriptor(), newMethodDescriptor() );
adapter.executionStarted( methodIdentifier );
verify( listener ).testStarting( entryCaptor.capture() );
@@ -102,18 +102,16 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWithCompatibleNameForMethodWithArguments()
+ public void notifiedWithCompatibleNameForMethodWithArguments()
throws Exception
{
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
- TestPlan testPlan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
+ TestPlan testPlan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
adapter.testPlanExecutionStarted( testPlan );
- TestIdentifier methodIdentifier =
- identifiersAsParentOnTestPlan(
- testPlan, newClassDescriptor(), newMethodDescriptor( String.class ) );
+ TestIdentifier methodIdentifier = identifiersAsParentOnTestPlan( testPlan, newClassDescriptor(),
+ newMethodDescriptor( String.class ) );
adapter.executionStarted( methodIdentifier );
verify( listener ).testStarting( entryCaptor.capture() );
@@ -125,7 +123,7 @@ class RunListenerAdapterTests
}
@Test
- void notifiedEagerlyForTestSetWhenClassExecutionStarted()
+ public void notifiedEagerlyForTestSetWhenClassExecutionStarted()
throws Exception
{
EngineDescriptor engine = newEngineDescriptor();
@@ -133,33 +131,25 @@ class RunListenerAdapterTests
engine.addChild( parent );
TestDescriptor child = newMethodDescriptor();
parent.addChild( child );
- TestPlan plan = TestPlan.from( Collections.singletonList( engine ) );
+ TestPlan plan = TestPlan.from( singletonList( engine ) );
adapter.testPlanExecutionStarted( plan );
adapter.executionStarted( TestIdentifier.from( engine ) );
adapter.executionStarted( TestIdentifier.from( parent ) );
- verify( listener )
- .testSetStarting(
- new SimpleReportEntry(
- JUnitPlatformProvider.class.getName(),
+ verify( listener ).testSetStarting( new SimpleReportEntry( JUnitPlatformProvider.class.getName(),
MyTestClass.class.getName() ) );
verifyNoMoreInteractions( listener );
adapter.executionStarted( TestIdentifier.from( child ) );
- verify( listener )
- .testStarting( new SimpleReportEntry( MyTestClass.class.getName(), MY_TEST_METHOD_NAME ) );
+ verify( listener ).testStarting( new SimpleReportEntry( MyTestClass.class.getName(), MY_TEST_METHOD_NAME ) );
verifyNoMoreInteractions( listener );
adapter.executionFinished( TestIdentifier.from( child ), successful() );
- verify( listener )
- .testSucceeded( new SimpleReportEntry( MyTestClass.class.getName(), MY_TEST_METHOD_NAME ) );
+ verify( listener ).testSucceeded( new SimpleReportEntry( MyTestClass.class.getName(), MY_TEST_METHOD_NAME ) );
verifyNoMoreInteractions( listener );
adapter.executionFinished( TestIdentifier.from( parent ), successful() );
- verify( listener )
- .testSetCompleted(
- new SimpleReportEntry(
- JUnitPlatformProvider.class.getName(),
+ verify( listener ).testSetCompleted( new SimpleReportEntry( JUnitPlatformProvider.class.getName(),
MyTestClass.class.getName() ) );
verifyNoMoreInteractions( listener );
@@ -168,21 +158,17 @@ class RunListenerAdapterTests
}
@Test
- void notifiedLazilyForTestSetWhenFirstTestWithoutClassDescriptorParentStarted()
+ public void notifiedLazilyForTestSetWhenFirstTestWithoutClassDescriptorParentStarted()
{
EngineDescriptor engine = newEngineDescriptor();
- TestDescriptor parent =
- newTestDescriptor(
- engine.getUniqueId().append( "container", "noClass" ), "parent",
- Type.CONTAINER );
+ TestDescriptor parent = newTestDescriptor( engine.getUniqueId().append( "container", "noClass" ), "parent",
+ CONTAINER );
engine.addChild( parent );
- TestDescriptor child1 =
- newTestDescriptor( parent.getUniqueId().append( "test", "child1" ), "child1", Type.TEST );
+ TestDescriptor child1 = newTestDescriptor( parent.getUniqueId().append( "test", "child1" ), "child1", TEST );
parent.addChild( child1 );
- TestDescriptor child2 =
- newTestDescriptor( parent.getUniqueId().append( "test", "child2" ), "child2", Type.TEST );
+ TestDescriptor child2 = newTestDescriptor( parent.getUniqueId().append( "test", "child2" ), "child2", TEST );
parent.addChild( child2 );
- TestPlan plan = TestPlan.from( Collections.singletonList( engine ) );
+ TestPlan plan = TestPlan.from( singletonList( engine ) );
adapter.testPlanExecutionStarted( plan );
adapter.executionStarted( TestIdentifier.from( engine ) );
@@ -191,9 +177,8 @@ class RunListenerAdapterTests
adapter.executionStarted( TestIdentifier.from( child1 ) );
InOrder inOrder = inOrder( listener );
- inOrder
- .verify( listener )
- .testSetStarting( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "parent" ) );
+ inOrder.verify( listener )
+ .testSetStarting( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "parent" ) );
inOrder.verify( listener ).testStarting( new SimpleReportEntry( "parent", "child1" ) );
inOrder.verifyNoMoreInteractions();
@@ -219,47 +204,43 @@ class RunListenerAdapterTests
}
@Test
- void notifiedForTestSetForSingleNodeEngine()
- {
- EngineDescriptor engine =
- new EngineDescriptor( UniqueId.forEngine( "engine" ), "engine" )
- {
- @Override
- public Type getType()
- {
- return Type.TEST;
- }
- };
- TestPlan plan = TestPlan.from( Collections.singletonList( engine ) );
+ public void notifiedForTestSetForSingleNodeEngine()
+ {
+ EngineDescriptor engine = new EngineDescriptor( UniqueId.forEngine( "engine" ), "engine" )
+ {
+ @Override
+ public Type getType()
+ {
+ return TEST;
+ }
+ };
+ TestPlan plan = TestPlan.from( singletonList( engine ) );
adapter.testPlanExecutionStarted( plan );
adapter.executionStarted( TestIdentifier.from( engine ) );
InOrder inOrder = inOrder( listener );
- inOrder
- .verify( listener )
- .testSetStarting( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "engine" ) );
+ inOrder.verify( listener )
+ .testSetStarting( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "engine" ) );
inOrder.verify( listener ).testStarting( new SimpleReportEntry( "<unrooted>", "engine" ) );
inOrder.verifyNoMoreInteractions();
adapter.executionFinished( TestIdentifier.from( engine ), successful() );
inOrder = inOrder( listener );
inOrder.verify( listener ).testSucceeded( new SimpleReportEntry( "<unrooted>", "engine" ) );
- inOrder
- .verify( listener )
- .testSetCompleted( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "engine" ) );
+ inOrder.verify( listener )
+ .testSetCompleted( new SimpleReportEntry( JUnitPlatformProvider.class.getName(), "engine" ) );
inOrder.verifyNoMoreInteractions();
}
@Test
- void notNotifiedWhenEngineExecutionStarted()
- throws Exception
+ public void notNotifiedWhenEngineExecutionStarted()
{
adapter.executionStarted( newEngineIdentifier() );
verify( listener, never() ).testStarting( any() );
}
@Test
- void notifiedWhenMethodExecutionSkipped()
+ public void notifiedWhenMethodExecutionSkipped()
throws Exception
{
adapter.executionSkipped( newMethodIdentifier(), "test" );
@@ -267,12 +248,10 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWithCorrectNamesWhenClassExecutionSkipped()
- throws Exception
+ public void notifiedWithCorrectNamesWhenClassExecutionSkipped()
{
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
- TestPlan testPlan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
+ TestPlan testPlan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
adapter.testPlanExecutionStarted( testPlan );
TestIdentifier classIdentifier =
@@ -287,15 +266,14 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWhenEngineExecutionSkipped()
- throws Exception
+ public void notifiedWhenEngineExecutionSkipped()
{
adapter.executionSkipped( newEngineIdentifier(), "test" );
verify( listener ).testSkipped( any() );
}
@Test
- void notifiedWhenMethodExecutionAborted()
+ public void notifiedWhenMethodExecutionAborted()
throws Exception
{
adapter.executionFinished( newMethodIdentifier(), TestExecutionResult.aborted( null ) );
@@ -303,38 +281,33 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWhenClassExecutionAborted()
- throws Exception
+ public void notifiedWhenClassExecutionAborted()
{
adapter.executionFinished( newClassIdentifier(), TestExecutionResult.aborted( null ) );
verify( listener ).testAssumptionFailure( any() );
}
@Test
- void notifiedWhenMethodExecutionFailedWithAnAssertionError()
+ public void notifiedWhenMethodExecutionFailedWithAnAssertionError()
throws Exception
{
- adapter.executionFinished(
- newMethodIdentifier(), TestExecutionResult.failed( new AssertionError() ) );
+ adapter.executionFinished( newMethodIdentifier(), TestExecutionResult.failed( new AssertionError() ) );
verify( listener ).testFailed( any() );
}
@Test
- void notifiedWhenMethodExecutionFailedWithANonAssertionError()
+ public void notifiedWhenMethodExecutionFailedWithANonAssertionError()
throws Exception
{
- adapter.executionFinished(
- newMethodIdentifier(), TestExecutionResult.failed( new RuntimeException() ) );
+ adapter.executionFinished( newMethodIdentifier(), TestExecutionResult.failed( new RuntimeException() ) );
verify( listener ).testError( any() );
}
@Test
- void notifiedWithCorrectNamesWhenClassExecutionFailed()
- throws Exception
+ public void notifiedWithCorrectNamesWhenClassExecutionFailed()
{
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
- TestPlan testPlan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
+ TestPlan testPlan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
adapter.testPlanExecutionStarted( testPlan );
adapter.executionFinished(
@@ -348,7 +321,7 @@ class RunListenerAdapterTests
}
@Test
- void notifiedWhenMethodExecutionSucceeded()
+ public void notifiedWhenMethodExecutionSucceeded()
throws Exception
{
adapter.executionFinished( newMethodIdentifier(), successful() );
@@ -356,8 +329,7 @@ class RunListenerAdapterTests
}
@Test
- void notifiedForTestSetWhenClassExecutionSucceeded()
- throws Exception
+ public void notifiedForTestSetWhenClassExecutionSucceeded()
{
EngineDescriptor engineDescriptor = newEngineDescriptor();
TestDescriptor classDescriptor = newClassDescriptor();
@@ -367,21 +339,17 @@ class RunListenerAdapterTests
adapter.executionFinished( TestIdentifier.from( classDescriptor ), successful() );
- verify( listener )
- .testSetCompleted(
- new SimpleReportEntry(
- JUnitPlatformProvider.class.getName(),
- MyTestClass.class.getName() ) );
+ verify( listener ).testSetCompleted( new SimpleReportEntry( JUnitPlatformProvider.class.getName(),
+ MyTestClass.class.getName() ) );
+
verify( listener, never() ).testSucceeded( any() );
}
@Test
- void notifiedWithParentDisplayNameWhenTestClassUnknown()
- throws Exception
+ public void notifiedWithParentDisplayNameWhenTestClassUnknown()
{
// Set up a test plan
- TestPlan plan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
+ TestPlan plan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Luke's Plan" ) ) );
adapter.testPlanExecutionStarted( plan );
// Use the test plan to set up child with parent.
@@ -397,15 +365,13 @@ class RunListenerAdapterTests
}
@Test
- void stackTraceWriterPresentWhenParentHasSource()
- throws Exception
+ public void stackTraceWriterPresentWhenParentHasSource()
{
- TestPlan plan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Some Plan" ) ) );
+ TestPlan plan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Some Plan" ) ) );
adapter.testPlanExecutionStarted( plan );
TestIdentifier child =
- newSourcelessChildIdentifierWithParent( plan, "Parent", ClassSource.from( MyTestClass.class ) );
+ newSourcelessChildIdentifierWithParent( plan, "Parent", ClassSource.from( MyTestClass.class ) );
adapter.executionFinished( child, TestExecutionResult.failed( new RuntimeException() ) );
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
verify( listener ).testError( entryCaptor.capture() );
@@ -413,11 +379,9 @@ class RunListenerAdapterTests
}
@Test
- void stackTraceWriterDefaultsToTestClass()
- throws Exception
+ public void stackTraceWriterDefaultsToTestClass()
{
- TestPlan plan =
- TestPlan.from( Collections.singletonList( new EngineDescriptor( newId(), "Some Plan" ) ) );
+ TestPlan plan = TestPlan.from( singletonList( new EngineDescriptor( newId(), "Some Plan" ) ) );
adapter.testPlanExecutionStarted( plan );
TestIdentifier child = newSourcelessChildIdentifierWithParent( plan, "Parent", null );
@@ -431,7 +395,7 @@ class RunListenerAdapterTests
}
@Test
- void stackTraceWriterPresentEvenWithoutException()
+ public void stackTraceWriterPresentEvenWithoutException()
throws Exception
{
adapter.executionFinished( newMethodIdentifier(), TestExecutionResult.failed( null ) );
@@ -441,13 +405,11 @@ class RunListenerAdapterTests
}
@Test
- void displayNamesIgnoredInReport()
+ public void displayNamesIgnoredInReport()
throws NoSuchMethodException
{
- TestMethodTestDescriptor descriptor =
- new TestMethodTestDescriptor(
- newId(), MyTestClass.class,
- MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ) );
+ TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor( newId(), MyTestClass.class,
+ MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ) );
TestIdentifier factoryIdentifier = TestIdentifier.from( descriptor );
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
@@ -482,8 +444,7 @@ class RunListenerAdapterTests
private static TestDescriptor newClassDescriptor()
{
- return new ClassTestDescriptor(
- UniqueId.root( "class", MyTestClass.class.getName() ), MyTestClass.class );
+ return new ClassTestDescriptor( UniqueId.root( "class", MyTestClass.class.getName() ), MyTestClass.class );
}
private static TestIdentifier newSourcelessChildIdentifierWithParent(
@@ -495,13 +456,13 @@ class RunListenerAdapterTests
when( parent.getDisplayName() ).thenReturn( parentDisplay );
when( parent.getLegacyReportingName() ).thenReturn( parentDisplay );
when( parent.getSource() ).thenReturn( Optional.ofNullable( parentTestSource ) );
- when( parent.getType() ).thenReturn( Type.CONTAINER );
+ when( parent.getType() ).thenReturn( CONTAINER );
TestIdentifier parentId = TestIdentifier.from( parent );
// The (child) test case that is to be executed as part of a test plan.
TestDescriptor child = mock( TestDescriptor.class );
when( child.getUniqueId() ).thenReturn( newId() );
- when( child.getType() ).thenReturn( Type.TEST );
+ when( child.getType() ).thenReturn( TEST );
when( child.getLegacyReportingName() ).thenReturn( "child" );
// Ensure the child source is null yet that there is a parent -- the special case to be tested.
@@ -561,18 +522,18 @@ class RunListenerAdapterTests
private static class MyTestClass
{
- @Test
+ @org.junit.jupiter.api.Test
void myTestMethod()
{
}
- @Test
+ @org.junit.jupiter.api.Test
void myTestMethod( String foo )
{
}
@DisplayName( "name" )
- @Test
+ @org.junit.jupiter.api.Test
void myNamedTestMethod()
{
}
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTests.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
similarity index 92%
rename from surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTests.java
rename to surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
index 3e8b533..efb0589 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTests.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestMethodFilterTest.java
@@ -28,7 +28,7 @@ import static org.mockito.Mockito.when;
import java.lang.reflect.Method;
import org.apache.maven.surefire.testset.TestListResolver;
-import org.junit.jupiter.api.Test;
+import org.junit.Test;
import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.platform.engine.FilterResult;
@@ -39,15 +39,14 @@ import org.junit.platform.engine.UniqueId;
*
* @since 2.22.0
*/
-class TestMethodFilterTests
+public class TestMethodFilterTest
{
-
private final TestListResolver resolver = mock( TestListResolver.class );
private final TestMethodFilter filter = new TestMethodFilter( this.resolver );
@Test
- void includesBasedOnTestListResolver()
+ public void includesBasedOnTestListResolver()
throws Exception
{
when( resolver.shouldRun( toClassFileName( TestClass.class ), "testMethod" ) ).thenReturn( true );
@@ -59,7 +58,7 @@ class TestMethodFilterTests
}
@Test
- void excludesBasedOnTestListResolver()
+ public void excludesBasedOnTestListResolver()
throws Exception
{
when( resolver.shouldRun( toClassFileName( TestClass.class ), "testMethod" ) ).thenReturn( false );
@@ -71,8 +70,7 @@ class TestMethodFilterTests
}
@Test
- void includesTestDescriptorWithClassSource()
- throws Exception
+ public void includesTestDescriptorWithClassSource()
{
FilterResult result = filter.apply( newClassTestDescriptor() );
@@ -90,7 +88,6 @@ class TestMethodFilterTests
}
private static ClassTestDescriptor newClassTestDescriptor()
- throws Exception
{
UniqueId uniqueId = UniqueId.forEngine( "class" );
return new ClassTestDescriptor( uniqueId, TestClass.class );
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTests.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTest.java
similarity index 82%
rename from surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTests.java
rename to surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTest.java
index a4f0883..a703a4b 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTests.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/TestPlanScannerFilterTest.java
@@ -26,9 +26,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.stream.Stream;
+import org.junit.Test;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestFactory;
import org.junit.platform.engine.Filter;
import org.junit.platform.launcher.core.LauncherFactory;
@@ -38,53 +38,52 @@ import org.junit.platform.launcher.core.LauncherFactory;
*
* @since 2.22.0
*/
-class TestPlanScannerFilterTests
+public class TestPlanScannerFilterTest
{
@Test
- void emptyClassIsNotAccepted()
+ public void emptyClassIsNotAccepted()
{
assertFalse( newFilter().accept( EmptyClass.class ), "does not accept empty class" );
}
@Test
- void classWithNoTestMethodsIsNotAccepted()
+ public void classWithNoTestMethodsIsNotAccepted()
{
- assertFalse(
- newFilter().accept( ClassWithMethods.class ), "does not accept class with no @Test methods" );
+ assertFalse( newFilter().accept( ClassWithMethods.class ), "does not accept class with no @Test methods" );
}
@Test
- void classWithTestMethodsIsAccepted()
+ public void classWithTestMethodsIsAccepted()
{
assertTrue( newFilter().accept( ClassWithTestMethods.class ) );
}
@Test
- void classWithNestedTestClassIsAccepted()
+ public void classWithNestedTestClassIsAccepted()
{
assertTrue( newFilter().accept( ClassWithNestedTestClass.class ) );
}
@Test
- void classWithDeeplyNestedTestClassIsAccepted()
+ public void classWithDeeplyNestedTestClassIsAccepted()
{
assertTrue( newFilter().accept( ClassWithDeeplyNestedTestClass.class ) );
}
@Test
- void classWithTestFactoryIsAccepted()
+ public void classWithTestFactoryIsAccepted()
{
assertTrue( newFilter().accept( ClassWithTestFactory.class ) );
}
@Test
- void classWithNestedTestFactoryIsAccepted()
+ public void classWithNestedTestFactoryIsAccepted()
{
assertTrue( newFilter().accept( ClassWithNestedTestFactory.class ) );
}
- private TestPlanScannerFilter newFilter()
+ private static TestPlanScannerFilter newFilter()
{
return new TestPlanScannerFilter( LauncherFactory.create(), new Filter<?>[0] );
}
@@ -113,7 +112,7 @@ class TestPlanScannerFilterTests
{
}
- @Test
+ @org.junit.jupiter.api.Test
public void test2()
{
}
@@ -130,7 +129,7 @@ class TestPlanScannerFilterTests
class TestClass
{
- @Test
+ @org.junit.jupiter.api.Test
void test1()
{
}
@@ -152,7 +151,7 @@ class TestPlanScannerFilterTests
class TestClass
{
- @Test
+ @org.junit.jupiter.api.Test
void test1()
{
}
--
To stop receiving notification emails like this one, please contact
tibordigana@apache.org.