File tree Expand file tree Collapse file tree
src/test/java/com/octopus Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .octopus ;
22
3+ import com .octopus .repository .AuthorRepository ;
34import org .junit .jupiter .api .Test ;
45import org .springframework .beans .factory .annotation .Autowired ;
56import org .springframework .boot .test .autoconfigure .web .servlet .AutoConfigureMockMvc ;
89import org .springframework .test .web .servlet .MockMvc ;
910import org .springframework .test .web .servlet .request .MockMvcRequestBuilders ;
1011
12+ import static org .junit .jupiter .api .Assertions .assertTrue ;
1113import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
1214
1315@ SpringBootTest
@@ -17,9 +19,17 @@ public class RandomQuotesControllerTest {
1719 @ Autowired
1820 private MockMvc mvc ;
1921
22+ @ Autowired
23+ private AuthorRepository authorRepository ;
24+
2025 @ Test
2126 public void getHello () throws Exception {
2227 mvc .perform (MockMvcRequestBuilders .get ("/api/quote" ).accept (MediaType .APPLICATION_JSON ))
2328 .andExpect (status ().isOk ());
2429 }
30+
31+ @ Test
32+ public void ensureAuthorsExists () {
33+ assertTrue (authorRepository .count () != 0 );
34+ }
2535}
You can’t perform that action at this time.
0 commit comments