Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. package contracts
  2.  
  3. org.springframework.cloud.contract.spec.Contract.make {
  4. request {
  5. method 'GET'
  6. url '/gls/v1/global-lookups?catalog=amenities'
  7. body("")
  8. }
  9. response {
  10. status 200
  11. body(""
  12. )
  13. headers {
  14. contentType(applicationJsonUtf8())
  15. }
  16. }
  17. }
  18.  
  19. package org.springframework.cloud.contract.verifier.tests;
  20.  
  21. public class ContractVerifierTest {
  22.  
  23. @Test
  24. public void validate_shouldGetAmenities() throws Exception {
  25. // given:
  26. MockMvcRequestSpecification request = given()
  27. .body("""");
  28.  
  29. // when:
  30. ResponseOptions response = given().spec(request)
  31. .get("/gls/v1/global-lookups?catalog=amenities");
  32.  
  33. // then:
  34. assertThat(response.statusCode()).isEqualTo(200);
  35. assertThat(response.header("Content-Type")).matches("application/json;charset=UTF-8.*");
  36. // and:
  37. String responseBody = response.getBody().asString();
  38. assertThat(responseBody).isEqualTo("");
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement