wvlet / airframe

Essential Building Blocks for Scala
https://wvlet.org/airframe
Apache License 2.0
632 stars 66 forks source link

Airspec: AirSpecLauncher throws an IllegalArgumentException when passing an object extenging the AirSpec trait #2370

Closed yuokada closed 2 years ago

yuokada commented 2 years ago

https://github.com/wvlet/airframe/blob/090f88e3dd2f2d629133a6da41cb1a444bda082b/airspec/src/main/scala/wvlet/airspec/AirSpecLauncher.scala#L69-L74

When I run AirSpecLauncher with the following setting on Intellij, it throws an IllegalArgumentException.

image

2022-08-17 18:22:50.838+0900  info [AirSpecLauncher] Run tests in wvlet.airframe.http.grpc.GrpcContextTest  - (AirSpecLauncher.scala:66)
2022-08-17 18:22:54.279+0900  warn [AirSpecLauncher] Class wvlet.airframe.http.grpc.GrpcContextTest extending AirSpec is not found  - (AirSpecLauncher.scala:72)
Exception in thread "main" java.lang.IllegalArgumentException: Class wvlet.airframe.http.grpc.GrpcContextTest extending AirSpec is not found
    at wvlet.airspec.AirSpecLauncher$.$anonfun$run$1(AirSpecLauncher.scala:73)
    at scala.Option.getOrElse(Option.scala:201)
    at wvlet.airspec.AirSpecLauncher$.run(AirSpecLauncher.scala:69)
    at wvlet.airspec.AirSpecLauncher$.execute(AirSpecLauncher.scala:45)
    at wvlet.airspec.AirSpecLauncher$.main(AirSpecLauncher.scala:27)
    at wvlet.airspec.AirSpecLauncher.main(AirSpecLauncher.scala)
Disconnected from the target VM, address: '127.0.0.1:55548', transport: 'socket'

When I pass a class extenging the AirSpec trait, AirSpecLauncher works well. So, I think that AirSpecLauncher can't find objects extending the Airspec trait.

xerial commented 2 years ago

I think it's just a bug of AirSpecLauncher. It should search class name like GrpcContextTest$ as well