Created
December 20, 2021 02:54
-
-
Save jenciso/ae8af51e37e62f46703d5944f59c9c10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello; | |
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.test.context.junit4.SpringRunner; | |
import org.springframework.test.web.servlet.MockMvc; | |
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | |
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; | |
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | |
@RunWith(SpringRunner.class) | |
@SpringBootTest(classes = App.class) | |
@AutoConfigureMockMvc | |
public class AppTest { | |
@Autowired | |
private MockMvc mvc; | |
@Test | |
public void helloGradle() throws Exception { | |
mvc.perform(get("/")) | |
.andExpect(status().isOk()) | |
.andExpect(content().string("Hello Gradle!")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment