Revert "[SUREFIRE-1842] - NPE at end of successful test run"
This reverts commit 8a7b2e6e
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/provider/ProviderParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/provider/ProviderParameters.java
index 6fc54ee..048622f 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/api/provider/ProviderParameters.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/provider/ProviderParameters.java
@@ -30,7 +30,6 @@
import org.apache.maven.surefire.api.util.RunOrderCalculator;
import org.apache.maven.surefire.api.util.ScanResult;
-import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
@@ -69,7 +68,6 @@
*
* @return A RunOrderCalculator
*/
- @Nullable
RunOrderCalculator getRunOrderCalculator();
/**
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/api/util/TestsToRun.java b/surefire-api/src/main/java/org/apache/maven/surefire/api/util/TestsToRun.java
index bdf9e64..28736ef 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/api/util/TestsToRun.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/api/util/TestsToRun.java
@@ -26,6 +26,8 @@
import java.util.List;
import java.util.Set;
+import org.apache.maven.surefire.api.testset.TestSetFailedException;
+
import static java.lang.Math.max;
/**
@@ -53,6 +55,7 @@
}
public static TestsToRun fromClass( Class<?> clazz )
+ throws TestSetFailedException
{
return new TestsToRun( Collections.<Class<?>>singleton( clazz ) );
}
diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/api/booter/BaseProviderFactoryTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/api/booter/BaseProviderFactoryTest.java
deleted file mode 100644
index 018e7f0..0000000
--- a/surefire-api/src/test/java/org/apache/maven/surefire/api/booter/BaseProviderFactoryTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.maven.surefire.api.booter;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.surefire.api.testset.DirectoryScannerParameters;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.Collections;
-
-import static org.junit.Assert.assertNull;
-
-/**
- * @author Michael Boyles
- */
-public class BaseProviderFactoryTest
-{
- @Test
- public void runOrderCalculatorIsNullIfNotSet()
- {
- BaseProviderFactory factory = new BaseProviderFactory( true );
- factory.setDirectoryScannerParameters ( getDirectoryScannerParameters() );
-
- assertNull( factory.getRunOrderCalculator() );
- }
-
- private DirectoryScannerParameters getDirectoryScannerParameters()
- {
- return new DirectoryScannerParameters(
- new File( "/fake/file" ),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- false,
- "ALPHABETICAL"
- );
- }
-}
diff --git a/surefire-providers/surefire-junit47/pom.xml b/surefire-providers/surefire-junit47/pom.xml
index 86f428f..ddac05f 100644
--- a/surefire-providers/surefire-junit47/pom.xml
+++ b/surefire-providers/surefire-junit47/pom.xml
@@ -54,11 +54,6 @@
<version>1.0-1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 372351a..6877b00 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -290,7 +290,6 @@
private TestsToRun scanClassPath()
{
TestsToRun scanned = scanResult.applyFilter( scannerFilter, testClassLoader );
- return runOrderCalculator == null
- ? scanned : runOrderCalculator.orderTestClasses( scanned );
+ return runOrderCalculator.orderTestClasses( scanned );
}
}
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreProviderTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreProviderTest.java
deleted file mode 100644
index 34cf112..0000000
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreProviderTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.apache.maven.surefire.junitcore;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.surefire.api.provider.ProviderParameters;
-import org.apache.maven.surefire.api.util.ScanResult;
-import org.apache.maven.surefire.api.util.ScannerFilter;
-import org.apache.maven.surefire.api.util.TestsToRun;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Iterator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Michael Boyles
- */
-@RunWith( MockitoJUnitRunner.class )
-public class JUnitCoreProviderTest
-{
- @Mock
- private ProviderParameters providerParameters;
- @Mock
- private ScanResult scanResult;
-
- @Test
- public void doNotSortTestsIfNoRunOrderProvider()
- {
- Mockito.when( providerParameters.getScanResult() ).thenReturn( scanResult );
- Mockito.when( scanResult.applyFilter( Mockito.any( ScannerFilter.class ), Mockito.any( ClassLoader.class ) ) )
- .thenReturn( TestsToRun.fromClass( String.class ) );
-
- JUnitCoreProvider provider = new JUnitCoreProvider( providerParameters );
- Iterator<Class<?>> suites = provider.getSuites().iterator();
-
- assertTrue( suites.hasNext() );
- assertEquals( String.class, suites.next() );
- assertFalse( suites.hasNext() );
- }
-}