package de.gedoplan.seminar.jpa.exercise;
|
|
import static org.hamcrest.CoreMatchers.is;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
|
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.TestMethodOrder;
|
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;
|
|
@TestMethodOrder(MethodOrderer.MethodName.class)
|
@AutoConfigureMockMvc
|
@SpringBootTest
|
public class Exercise03Test {
|
|
@Autowired
|
MockMvc mockMvc;
|
|
@Test
|
void test01_findByOrigin() throws Exception {
|
mockMvc.perform(get("/highways/findByOrigin/{origin}", "Dortmund"))
|
.andExpect(jsonPath("$.size()",is(2)));
|
}
|
|
@Test
|
void test02_countOrigins() throws Exception {
|
mockMvc.perform(get("/highways/countOrigins"))
|
.andExpect(jsonPath("$",is(2)));
|
}
|
}
|