Skip to content

Instantly share code, notes, and snippets.

@henesgokdag
Created April 16, 2022 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henesgokdag/c25bedd05eb7b6261223381e9a462460 to your computer and use it in GitHub Desktop.
Save henesgokdag/c25bedd05eb7b6261223381e9a462460 to your computer and use it in GitHub Desktop.
mockGetPeople
public PeopleResponse mockGetPeople(OrderRequest orderRequest,Boolean isDarthVader) throws JsonProcessingException {
PeopleResponse peopleResponse = RandomDataProvider.random().nextObject(PeopleResponse.class);
if(isDarthVader) peopleResponse.setName("Darth Vader");
String response = objectMapper.writeValueAsString(peopleResponse);
stubFor(get("/people/"+orderRequest.getPeopleId())
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody(String.valueOf(response))));
return peopleResponse;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment