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