I'm trying to use Java ServiceLoader in Scala 2.10 to find all my test classes by reflection:
val services = ServiceLoader.load(classOf[MyClass])
for (service <- services.asScala) {
test(service.getClass.getCanonicalName) {
println(service)
... test code
}
}
I'm very sure 'MyClass' has several subclasses which contains test cases, as I can use 'classOf[]' function to find them in the same code snippet
However, my test always ends with
Empty test suite.
Is the ServiceLoader not working in Scala? How to fix or circumvent this problem?
Aucun commentaire:
Enregistrer un commentaire