Cannot use label names selected by Kotlin method in androidTest - exception for handle

In my unit tests, I use Kotlin reverse processing methods for better readability, for example.

@Test fun `Foo should return bar`()

It works well and good for tests in a directory <module>/src/test, but when I try to do the same in <module>/src/androidTest, I get an exception:

Error:java.lang.IllegalArgumentException: bad descriptor: Lcom/packageName/MainActivityTest$Foo should return bar$1;
Error:Execution failed for task ':sample:transformClassesWithDexBuilderForDebugAndroidTest'. > com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.iface.ParseException: bad descriptor: Lcom/packageName/MainActivityTest$Foo should return bar$1;

Is there any trick to make it work?

+4
source share

Source: https://habr.com/ru/post/1685934/


All Articles