Skip to content

Instantly share code, notes, and snippets.

View anand58's full-sized avatar

Anand Tiwari anand58

View GitHub Profile
@anand58
anand58 / AccountControllerTest.groovy
Created February 21, 2020 09:46 — forked from jeffsheets/AccountControllerTest.groovy
Spock test with Mocks of Spring MVC Rest Controller using standaloneSetup and mockMvc
import groovy.json.JsonSlurper
import org.springframework.test.web.servlet.MockMvc
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.http.HttpStatus.*
import spock.lang.Specification
/**
* A Spock Spring MVC Rest unit test that doesn't require a full spring context
*/