This is an automated email from the ASF dual-hosted git repository. He-Pin pushed a commit to branch feature/junit6-migration in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
commit 3aeff492a3693bfe5e467f16bcd57ecc5fa3be5c Author: 虎鸣 <[email protected]> AuthorDate: Sat Jun 27 13:04:57 2026 +0800 fix: restore ScalaTest JUnit 4 bridge for Gradle test discovery in plugin-tester-scala Motivation: Removing @RunWith(classOf[JUnitRunner]) and replacing scalatestplus:junit-4-13 with junit-jupiter:6.1.0 in plugin-tester-scala causes Gradle's test task to discover 0 tests. Gradle 7.6 uses JUnit 4 by default and requires the JUnit 4 runner to discover ScalaTest specs. This would silently pass CI with no tests executed. Modification: Revert plugin-tester-scala/build.gradle test dependency to scalatestplus:junit-4-13 and restore @RunWith(classOf[JUnitRunner]) in ErrorReportingSpec and GreeterServiceSpec. The Gradle plugin-tester projects use ScalaTest with a JUnit 4 bridge for test discovery, which is independent of the JUnit Jupiter migration in the main project. Result: Gradle test discovery for plugin-tester-scala tests is preserved. Tests: Gradle tests in plugin-tester-scala will be discovered and executed via the JUnit 4 runner bridge. References: Refs #758 --- plugin-tester-scala/build.gradle | 2 +- .../src/test/scala/example/myapp/helloworld/ErrorReportingSpec.scala | 3 +++ .../src/test/scala/example/myapp/helloworld/GreeterServiceSpec.scala | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin-tester-scala/build.gradle b/plugin-tester-scala/build.gradle index 1f52494f..07e576f6 100644 --- a/plugin-tester-scala/build.gradle +++ b/plugin-tester-scala/build.gradle @@ -34,7 +34,7 @@ dependencies { testImplementation "org.apache.pekko:pekko-actor-testkit-typed_${scalaBinaryVersion}:${pekkoVersion}" testImplementation "org.apache.pekko:pekko-stream-testkit_${scalaBinaryVersion}:${pekkoVersion}" testImplementation "org.scalatest:scalatest_${scalaBinaryVersion}:3.2.20" - testImplementation "org.junit.jupiter:junit-jupiter:6.1.0" + testImplementation "org.scalatestplus:junit-4-13_${scalaBinaryVersion}:3.2.20.0" } tasks.withType(Copy).configureEach { diff --git a/plugin-tester-scala/src/test/scala/example/myapp/helloworld/ErrorReportingSpec.scala b/plugin-tester-scala/src/test/scala/example/myapp/helloworld/ErrorReportingSpec.scala index 236ebdfb..ae43a08d 100644 --- a/plugin-tester-scala/src/test/scala/example/myapp/helloworld/ErrorReportingSpec.scala +++ b/plugin-tester-scala/src/test/scala/example/myapp/helloworld/ErrorReportingSpec.scala @@ -23,15 +23,18 @@ import pekko.http.scaladsl.Http import pekko.stream.scaladsl.Sink import example.myapp.helloworld.grpc.{ GreeterService, GreeterServiceHandler } import io.grpc.Status +import org.junit.runner.RunWith import org.scalatest.BeforeAndAfterAll import org.scalatest.concurrent.ScalaFutures import org.scalatest.matchers.should.Matchers import org.scalatest.time.Span import org.scalatest.wordspec.AnyWordSpec +import org.scalatestplus.junit.JUnitRunner import scala.concurrent.Await import scala.concurrent.duration._ +@RunWith(classOf[JUnitRunner]) class ErrorReportingSpec extends AnyWordSpec with Matchers with ScalaFutures with BeforeAndAfterAll { override implicit val patienceConfig: PatienceConfig = PatienceConfig(5.seconds, Span(100, org.scalatest.time.Millis)) diff --git a/plugin-tester-scala/src/test/scala/example/myapp/helloworld/GreeterServiceSpec.scala b/plugin-tester-scala/src/test/scala/example/myapp/helloworld/GreeterServiceSpec.scala index 030460b0..676bdbc6 100644 --- a/plugin-tester-scala/src/test/scala/example/myapp/helloworld/GreeterServiceSpec.scala +++ b/plugin-tester-scala/src/test/scala/example/myapp/helloworld/GreeterServiceSpec.scala @@ -19,15 +19,18 @@ import pekko.grpc.GrpcClientSettings import com.google.protobuf.timestamp.Timestamp import com.typesafe.config.ConfigFactory import example.myapp.helloworld.grpc._ +import org.junit.runner.RunWith import org.scalatest.BeforeAndAfterAll import org.scalatest.concurrent.ScalaFutures import org.scalatest.matchers.should.Matchers import org.scalatest.time.Span import org.scalatest.wordspec.AnyWordSpecLike +import org.scalatestplus.junit.JUnitRunner import scala.concurrent.{ Await, ExecutionContext } import scala.concurrent.duration._ +@RunWith(classOf[JUnitRunner]) class GreeterServiceSpec extends Matchers with AnyWordSpecLike with BeforeAndAfterAll with ScalaFutures { implicit val patience: PatienceConfig = PatienceConfig(10.seconds, Span(100, org.scalatest.time.Millis)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
