title: How to Unit test PUT method correctly
body: <p>I'm trying to test a PUT request for updating a product entity assuming that the product does not exist yet. And therefore I'm modelling the following logic in my test: </p>
  
  <ul>
  <li>Create a product. The product has a List as a field which size autoincrements each time the product is created or updated. So I expect the size to be equal to 1 right after creation. </li>
  <li>Perform a GET request to check the size. The assertion <code>assertTrue(response.getBody().getData().size() == 1);</code> returns true as expected.</li>
  <li>Then I want to model a PUT request and check if the <code>size</code> field of the updated product has incremented. 
  So the assertion would be that the size field of the updated product must be greater than its size from the previous update request. </li>
  </ul>
  
  <p>But I'm stuck at this point and need an advice on how to proceed with the PUT request in this situation.</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.PUT)
          @ResponseStatus(HttpStatus.OK)
          void updateProduct(@PathVariable("name") String productName); 
  
  @Test
          public void checkUpdated() {
  
          Product newProduct = createProduct(SIMPLE_PRODUCT);
  
          ResponseEntity&lt;SimpleProduct&gt; response = restTemplate.getForEntity("/products/{name}/?fields={fields}",
                      SimpleProduct.class, SIMPLE_PRODUCT);
              assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
              assertTrue(response.getBody().getData().size() == 1); 
  }
  </code></pre>