title: Snapshot testing in Spring MVC test
body: <p>Is there any existing solution for doing snapshot testing [1] in Spring MVC test (MockMvc)?</p>
  
  <p>Something like:</p>
  
  <pre><code>this.mockMvc.perform(get("/users")
    .andExpect(status().isOk())
    .andExpect(content().contentType("application/json"))
    .andExpect(matchesSnapshot("__snapshots__/users/list.json"));
  </code></pre>
  
  <p>Running this test first time would make test pass and write response content to <code>src/main/resources/__snapshots__/users/list.json</code>.</p>
  
  <p>Running this test second time compares response content to <code>src/main/resources/__snapshots__/users/list.json</code>. If it's the same, it passes. Otherwise, it fails.</p>
  
  <p>[1] <a href="https://jestjs.io/docs/en/snapshot-testing" rel="nofollow noreferrer">https://jestjs.io/docs/en/snapshot-testing</a></p>