-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemControllerTest.java
More file actions
26 lines (19 loc) · 864 Bytes
/
ItemControllerTest.java
File metadata and controls
26 lines (19 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.mrxgrc.inventory;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
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.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@WebMvcTest(ItemController.class)
public class ItemControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
void getItemsReturnsListofItems() throws Exception{
this.mockMvc.perform(get("/items"))
.andExpect(status().isOk())
.andExpect(content().string("List of items"));
}
}