pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

Junit wrapper's state annotation suggestion doesn't escape double quotes

Open TimothyJones opened this issue 2 years ago • 0 comments

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

TimothyJones avatar Oct 25 '21 00:10 TimothyJones