Commit d4e07540 authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

tests for error- and advanced search controller

parent 6bdaca6c
Pipeline #135173 passed with stages
in 9 minutes and 2 seconds
package info.textgrid.rep.search;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
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.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@SpringBootTest
@AutoConfigureMockMvc
public class AdvancedSearchControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void showAdvancedSearch() throws Exception {
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders
.get("/advanced-search");
mvc.perform(builder)
.andExpect(view().name("advancedsearch"))
.andExpect(forwardedUrl("/WEB-INF/jsp/advancedsearch.jsp"))
.andExpect(status().isOk());
}
}
package info.textgrid.rep.search;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
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.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
@SpringBootTest
@AutoConfigureMockMvc
public class ErrorControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void showError() throws Exception {
MockHttpServletRequestBuilder builder = MockMvcRequestBuilders
.get("/error");
mvc.perform(builder)
.andExpect(view().name("error"))
.andExpect(forwardedUrl("/WEB-INF/jsp/error.jsp"));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment