mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-23 22:50:51 +08:00
26 lines
1003 B
Java
26 lines
1003 B
Java
package com.openisle.controller;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
|
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.jsonPath;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
|
@WebMvcTest(HelloController.class)
|
|
@AutoConfigureMockMvc(addFilters = false)
|
|
class HelloControllerTest {
|
|
@Autowired
|
|
private MockMvc mockMvc;
|
|
|
|
@Test
|
|
void helloReturnsMessage() throws Exception {
|
|
mockMvc.perform(get("/api/hello"))
|
|
.andExpect(status().isOk())
|
|
.andExpect(jsonPath("$.message").value("Hello, Authenticated User"));
|
|
}
|
|
}
|