Given a simple test which takes one test parameter as a constructor parameter and the other as a test method parameter
```
@RunWith(TestParameterInjector::class)
class TestParameterInjectorTest(
@TestParameter config: Config
) {
enum class Config(
val deviceConfig: DeviceConfig
) {
NEXUS_4(deviceConfig = DeviceConfig.NEXUS_4),
NEXUS_5(deviceConfig = DeviceConfig.NEXUS_5),
NEXUS_5_LAND(deviceConfig = DeviceConfig.NEXUS_5.copy(orientation = LANDSCAPE))
}
object AmountProvider : TestParameterValuesProvider() {
override fun provideValues(context: Context): List<String> = listOf("\$1.00", "\$2.00", "\$5.00", "\$10.00")
}
@Test
fun amountProviderTest(@TestParameter(valuesProvider = AmountProvider::class) amount: String) {
...
}
}
```
in 1.19, the test method name was:
```
TestParameterInjectorTest_amountProviderTest[NEXUS_5,$1.00]
```
in 1.20, the test method name is now:
```
TestParameterInjectorTest_amountProviderTest[NEXUS_5,amount=$1.00]
```
was this intentional? is there a way to disable?
Hi!
The 1.20 behavior was always the intention, but Java by default doesn't include parameter name info. Your project doesn't have it enabled, I suspect. Therefore, the fallback is to not show the name in the test names, and also `@TestParameters` won't work.
However, with 1.20, TestParameterInjector is able to read the parameter names via Kotlin reflection. And that's why you're seeing it added in the test name.
The reason why we added it there from the beginning is that it can be helpful for humans to see in the test name which parameters are what value. E.g.
```
myTest[false, true, 1, :]
```
is worse than
```
myTest[dryRun=false, expectFoo=true, count=1, delimiter=:]
```
The string case is governed by this heuristic:
```
if (unwrappedValue instanceof CharSequence
&& CharMatcher.anyOf("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
.matchesNoneOf((CharSequence) unwrappedValue)) {
// add parameter name
}
```
I agree this heuristic is perhaps unnecessary for the `$1.00` case, but I'm not sure it is worth changing it, and breaking clients that rely on the test name [again] (of which you may be one).
ok that makes sense, but why wouldn't the 1st arg also have this naming feature?, i.e.,
instead of this:
```
TestParameterInjectorTest_amountProviderTest[NEXUS_5,amount=$1.00]
```
i would expect this:
```
TestParameterInjectorTest_amountProviderTest[config=NEXUS_5,amount=$1.00]
```
per the earlier test snippet.