mardi 10 avril 2018

PactDslJsonBody is failing to create JSON object

@Pact(provider="Appointment_Provider",consumer = "Appointment_Consumer") public PactFragment createFragmentAppointmentDetails (PactDslWithProvider builder) throws ParseException{

        Map<String, String> headers = new HashMap<>(); 
        headers.put("Content-Type", "application/json"); 


        return builder
                .given("GetAppoinment")
                .uponReceiving("Get Appointment information")
                .path("/getappointment")
                .query("apptId=11207")
                .method("GET")
                .willRespondWith()
                .headers(headers)
                .status(200)
                .body(new PactDslJsonBody()
                        .object("appointments")
                        .stringValue("type","Test \\u0026 Turn up")
                        .stringValue("apptId","11207")
                        .closeObject()
                        )
                .toFragment()
                ;

}

Aucun commentaire:

Enregistrer un commentaire