Files
spring-soap/spring-boot-mvc/src/test/java/com/baeldung/accessparamsjs/ControllerUnitTest.java
Andrey Shcherbakov 191039ffc6 Add code for issue BAEL-2574 (#6249)
* Add code for issue BAEL-2574

This is a code for article "Access Spring MVC Model object in JS"

Set up the project

Add a test

* Rename the test class
2019-01-31 22:19:07 -08:00

29 lines
1000 B
Java

package com.baeldung.accessparamsjs;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class ControllerUnitTest {
@Autowired
private MockMvc mvc;
@Test
public void whenRequestIndex_thenStatusOk() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/index")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}
}