pact-jvm
pact-jvm copied to clipboard
Junit wrapper's state annotation suggestion doesn't escape double quotes
When you're using the JUnit wrapper and you are missing a state handler, the wrapper helpfully tells you what the state annotation should be. However, if the state string has "
characters in it, they're not escaped, so you can't copy and paste the state string.
To reproduce:
Create a consumer contract with a state like Some state "with quotes"
, and verify this in a JUnit test without implementing any state handlers.
Expected behaviour:
An error message that reads:
Did not find a test class method annotated with @State("Some state \"with quotes\"")
This can then be copied and pasted into the test code.
Actual behaviour:
An error message that reads
Did not find a test class method annotated with @State("Some state "with quotes"")
This cannot be safely copied and pasted because the quotes are not escaped