Skip to content

Commit f996229

Browse files
committed
Refactor test filtering: use ConcurrentHashMap.newKeySet for exclusions and tag tests with "org.scalatest.Selected"
1 parent 8cc8458 commit f996229

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/scala/org/scalatestplus/junit/JUnitRunner.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import org.junit.runner.notification.Failure
2222
import org.junit.runner.Description
2323
import org.junit.runner.manipulation.{Filter => TestFilter, Filterable, NoTestsRemainException}
2424

25+
import java.util.concurrent.ConcurrentHashMap
2526
import scala.collection.JavaConverters._
2627
import scala.collection.mutable
2728

@@ -74,7 +75,7 @@ final class JUnitRunner(suiteClass: java.lang.Class[_ <: Suite]) extends org.jun
7475
*/
7576
val getDescription = createDescription(suiteToRun)
7677

77-
private val excludedTests: mutable.Set[String] = mutable.Set()
78+
private val excludedTests: mutable.Set[String] = ConcurrentHashMap.newKeySet[String]().asScala
7879

7980
private def createDescription(suite: Suite): Description = {
8081
val description = Description.createSuiteDescription(suite.getClass)
@@ -104,10 +105,10 @@ final class JUnitRunner(suiteClass: java.lang.Class[_ <: Suite]) extends org.jun
104105
val includedTests: Set[String] = suiteToRun.testNames.diff(excludedTests)
105106
val testTags: Map[String, Map[String, Set[String]]] = Map(
106107
suiteToRun.suiteId ->
107-
includedTests.map(test => test -> Set("INCLUDE")).toMap
108+
includedTests.map(test => test -> Set("org.scalatest.Selected")).toMap
108109
)
109110
val filter = Filter(
110-
tagsToInclude = Some(Set("INCLUDE")),
111+
tagsToInclude = Some(Set("org.scalatest.Selected")),
111112
dynaTags = DynaTags(suiteTags = Map.empty, testTags = testTags)
112113
)
113114
// TODO: What should this Tracker be?

0 commit comments

Comments
 (0)