Advertisement
Guest User

Untitled

a guest
May 6th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.76 KB | None | 0 0
  1. class ProductEndpoinSpec extends IntegrationSpec{
  2.  
  3.     @Autowired
  4.     ProductFacade productFacade
  5.  
  6.     def "chould return product"(){
  7.         given: "define existing product"
  8.             def product = new ProductRequestDto(null, "czerwony patyk")
  9.  
  10.         and: "save defined product"
  11.             def createdProduct = productFacade.create(product)
  12.  
  13.         and: "get request"
  14.             def url = url("/products/${createdProduct.getId()}")
  15.  
  16.         when: "get request"
  17.             def response = httpClient.getForEntity(url, ProductResponseDto.class)
  18.  
  19.         then: "check status code if it is 200"
  20.             response.getStatusCode() == OK
  21.  
  22.         and: "returned product is equal to existing one"
  23.             response.getBody() == createdProduct
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement