-1

I am trying a simple pact test but its failing giving the error. Below is my code. Is there any issue with the way I'm trying to call pact.

ERROR:

groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object  The current character read is 'T' with an int value of 84 

CODE

public class PactTest1 {

    @Rule
    //public PactProviderRule rule = new PactProviderRule("assessments", this);
    public PactProviderRule provider = new PactProviderRule("test_provider", "localhost", 8080, this);

    @Pact(state = "default", provider = "test_provider", consumer = "test_consumer")
     public PactFragment createFragment(PactDslWithProvider builder) {
                Map<String, String> headers = new HashMap<>();
                headers.put("content-type", "application/json");


        return builder
          .given("test GET")
            .uponReceiving("GET REQUEST")
            .path("/assessments")
            .method("GET")
          .willRespondWith()
            .status(200)
            .headers(headers)
            .body("Test Successful")
            .toFragment();
    }

    @Test
    @PactVerification("test_provider")
    public void runTest() {

        final RestTemplate call = new RestTemplate();
        // when
        final String response = call.getForObject(provider.getConfig().url()+"/assessments", String.class);
        assertEquals(response, "Test Successful");

    }

}
user3310115
  • 1,372
  • 2
  • 18
  • 48

1 Answers1

0

It worked after the changed the header content type to text/json. However I'm not able to find the pact file. Where can I find it?

user3310115
  • 1,372
  • 2
  • 18
  • 48