2023-01-26
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
package kr.pe.elex.examples;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
@@ -35,7 +36,7 @@ class ControllerTest2 {
|
||||
private MyService service;
|
||||
|
||||
@BeforeEach
|
||||
void beforeAll() {
|
||||
void beforeEach() {
|
||||
Mockito.when(service.sayHello())
|
||||
.thenReturn("Hello, Mock");
|
||||
}
|
||||
@@ -43,9 +44,9 @@ class ControllerTest2 {
|
||||
@Test
|
||||
void greetingsTest() throws Exception {
|
||||
this.mockMvc.perform(get("/greetings"))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().string(containsString("Hello, Mock")));
|
||||
.andExpect(content().string(containsString("Hello, Mock")))
|
||||
.andDo(print());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user