I have a Parameterized
test to which I pass an object as a parameter. I know I can give a custom name with @Parameters(name="{2}")
, but the default toString()
is called and it's not very clear. I would like to have a method which would return a string depending on the object attributes. For now I added another parameter for this. Is there a way to add a method for this ?
Asked
Active
Viewed 1,764 times
1

Eko
- 1,487
- 1
- 18
- 36
-
1would overriding the `toString` method work? – Feb 22 '19 at 08:06
-
Pass in an extra parameter containing the name you want to display? – Andy Turner Feb 22 '19 at 08:12
-
@ValentinCarnu no I can't change it. – Eko Feb 22 '19 at 08:35
-
@AndyTurner Yes that's what I'm doing right now but I wonder if there is a better way to do it – Eko Feb 22 '19 at 08:35
-
You could wrap the parameter in a custom class and override toString there. – kapex Feb 22 '19 at 09:22