test code update
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.egovframe.cloud.portalservice.domain.menu;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -42,6 +43,12 @@ class MenuRepositoryTest {
|
||||
siteRepository.saveAll(sites);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
menuRepository.deleteAll();
|
||||
siteRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void 새로운메뉴_한건_등록() throws Exception {
|
||||
Site site = siteRepository.findAll().get(0);
|
||||
|
||||
@@ -134,6 +134,7 @@ class PolicyRepositoryTest {
|
||||
|
||||
@Test
|
||||
public void ID로_한건조회() throws Exception {
|
||||
Policy save = null;
|
||||
//given
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
String title = "title_"+i;
|
||||
@@ -143,7 +144,7 @@ class PolicyRepositoryTest {
|
||||
type = "PP";
|
||||
}
|
||||
|
||||
policyRepository.save(Policy.builder()
|
||||
save = policyRepository.save(Policy.builder()
|
||||
.type(type)
|
||||
.title(title)
|
||||
.contents(contentStr)
|
||||
@@ -151,12 +152,11 @@ class PolicyRepositoryTest {
|
||||
}
|
||||
|
||||
//when
|
||||
Optional<Policy> optionalTerms = policyRepository.findById(1L);
|
||||
Optional<Policy> optionalTerms = policyRepository.findById(save.getId());
|
||||
|
||||
//then
|
||||
System.out.println(optionalTerms.get());
|
||||
assertThat(optionalTerms.get().getTitle()).isEqualTo("title_1");
|
||||
assertThat(optionalTerms.get().getContents()).isEqualTo("contents 1");
|
||||
assertThat(optionalTerms.get().getTitle()).isEqualTo(save.getTitle());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user