title: How to send json instead of params in spring test
body: <p>I call Spring controller using org.springframework.test.web.servlet.MockMvc.</p>
  
  <p>It looks like this:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @WebAppConfiguration
  @ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/spring/root-context.xml" })
  public class TestController {
  
      @Mock
      private TestService testService;
  
      @InjectMocks
      private TestController testController;
  
      private MockMvc mockMvc;
  
      @Before
      public void setup() {
          MockitoAnnotations.initMocks(this);
          this.setMockMvc(MockMvcBuilders.standaloneSetup(testtController).build());
      }
  
      @Test
      public void test() throws Exception {
          this.mockMvc.perform(post("/trans/").param("name", "grep")).andExpect(status().isOk());
      }
  </code></pre>
  
  <p>Everything looks well.  I can pass params too. 
  But now I need to send JSON (String) instead of params. How can I do this?</p>