2023-01-26

This commit is contained in:
2023-01-26 00:32:02 +09:00
parent 39a57945f9
commit 5de59df669
15 changed files with 575 additions and 55 deletions

View File

@@ -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());
}
}