title: How can I do to generate test stubs with Spring cloud contract If an endpoint return List elements
body: <ul>
  <li>User</li>
  </ul>
  <pre class="lang-java prettyprint-override"><code>
      UUID userId;
  
      String email;
  
      String name;
  
      Set&lt;String&gt; permissions;
  
  
  </code></pre>
  <ul>
  <li>data list is returned</li>
  </ul>
  <pre class="lang-json prettyprint-override"><code>
      {
          &quot;userId&quot;: &quot;XXXX-XXX-XXXXX-xxxxx-XXXXXX&quot;,
          &quot;email&quot;: &quot;ler@mail.com&quot;,
          &quot;username&quot;: &quot;g.mark&quot;,
          &quot;permissions&quot;: [
              &quot;root&quot;,
              &quot;admin&quot;
          ]
      },
      {
          &quot;userId&quot;: &quot;XXXX-XXX-XXXXX-xxxxx-XXXXXX&quot;,
          &quot;email&quot;: &quot;som@mail.com&quot;,
          &quot;username&quot;: &quot;b.sim&quot;,
          &quot;permissions&quot;: [
              &quot;manager&quot;,
              &quot;user&quot;
          ]
      },
  </code></pre>
  <ul>
  <li>Rest</li>
  </ul>
  <pre class="lang-java prettyprint-override"><code>@RestController
  public class DummyController {
  
      @GetMapping
      public List&lt;User&gt; getList() {
          return Arrays.asList(new User (.....), new User (.....));
      }
  }
  </code></pre>
  <ul>
  <li>spring cloud contract</li>
  </ul>
  <pre><code>package contracts.user
  
  import org.springframework.cloud.contract.spec.Contract
  
  [
          Contract.make {
              name('list')
              request {
                  method(GET())
                  url('/users')
                  headers {
                      contentType(applicationJson())
                  }
              }
              response {
                  status(OK())
                  headers {
                      contentType applicationJson()
                  }
              }
          }
  ]
  </code></pre>
  <p>But I'm not sure how to check the response correctly. that the list has arrived, that it is not empty, check that the list items correspond to the received data (for example, using built-in functions like <strong>regex(uuid*()</strong>) or <strong>anyAlphaUnicode()</strong>). Also, do not forget that there are list items - a nested list. At the same time, it is enough to pick up one element and check, but not check the entire list (at least not to describe it here).</p>
  <p>Do you have any ideas how this can be checked?</p>