Skip to content

Commit

Permalink
Merge pull request #350 from miIlicon/development
Browse files Browse the repository at this point in the history
Version 1.0.1
  • Loading branch information
gkfktkrh153 authored Oct 8, 2023
2 parents aca22b2 + 68c0acc commit a5e704c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.festival.common.base.OperateStatus;
import com.festival.common.exception.ErrorCode;
import com.festival.common.exception.custom_exception.NotFoundException;
import com.festival.domain.bambooforest.dto.BamBooForestPageRes;
import com.festival.domain.booth.controller.dto.BoothPageRes;
import com.festival.domain.booth.controller.dto.BoothReq;
import com.festival.domain.booth.controller.dto.BoothRes;
Expand Down Expand Up @@ -34,8 +33,7 @@
import static com.festival.domain.member.model.MemberRole.ADMIN;
import static com.festival.domain.member.model.MemberRole.MANAGER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.*;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.assertj.core.groups.Tuple.tuple;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
Expand Down Expand Up @@ -122,6 +120,7 @@ void updateBooth() throws Exception {


Booth booth = Booth.of(boothReq);
booth.setImage(createImage());
booth.connectMember(member);
Booth savedBooth = boothRepository.saveAndFlush(booth);

Expand Down Expand Up @@ -416,7 +415,7 @@ void getBooth() throws Exception {
//then
BoothRes findBooth = new ObjectMapper().readValue(mvcResult.getResponse().getContentAsString(), BoothRes.class);
assertThat(findBooth).isNotNull()
.extracting("title", "content", "type", "status")
.extracting("title", "content", "type", "operateStatus")
.containsExactly(boothReq.getTitle(), boothReq.getContent(), "FOOD_TRUCK", "TERMINATE");
}

Expand Down Expand Up @@ -459,7 +458,7 @@ void getBoothList() throws Exception {
//then
BoothPageRes boothPageRes = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), BoothPageRes.class);
assertThat(boothPageRes.getBoothResList()).hasSize(6)
.extracting("title", "content", "type", "status")
.extracting("title", "content", "type", "operateStatus")
.containsExactlyInAnyOrder(
tuple("testTitle1", "testContent1", "FOOD_TRUCK", "TERMINATE"),
tuple("testTitle2", "testContent2", "FOOD_TRUCK", "TERMINATE"),
Expand Down Expand Up @@ -529,4 +528,11 @@ private List<MockMultipartFile> getSubFiles() throws IOException {
TestImageUtils.generateMockImageFile("subFiles")
);
}

private Image createImage() {
return Image.builder()
.mainFilePath("/mainFile")
.subFilePaths(List.of("/subFile1", "/subFile2"))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.festival.domain.booth.model.BoothType;
import com.festival.domain.booth.repository.BoothRepository;
import com.festival.domain.booth.service.vo.BoothListSearchCond;
import com.festival.domain.image.fixture.ImageFixture;
import com.festival.domain.image.model.Image;
import com.festival.domain.image.service.ImageService;
import com.festival.domain.member.fixture.MemberFixture;
import com.festival.domain.member.service.MemberService;
Expand All @@ -26,8 +26,6 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.test.util.ReflectionTestUtils;

import java.io.IOException;
Expand Down Expand Up @@ -345,7 +343,7 @@ void deleteBooth4(){
void getBoothTest(){
//given
Booth foodTruck = BoothFixture.FOOD_TRUCK;
ReflectionTestUtils.setField(foodTruck, "image", ImageFixture.IMAGE);
ReflectionTestUtils.setField(foodTruck, "image", createImage());

given(boothRepository.findById(1L))
.willReturn(Optional.of(foodTruck));
Expand Down Expand Up @@ -421,4 +419,11 @@ private BoothReq getBoothUpdateReq() throws IOException {
.build();
return boothReq;
}

private Image createImage() {
return Image.builder()
.mainFilePath("/mainFile")
.subFilePaths(List.of("/subFile1", "/subFile2"))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void deleteGuide4(){
void getguideTest(){
//given
Guide guide = getGuide();

guide.connectMember(MemberFixture.ADMIN);
given(guideRepository.findById(1L))
.willReturn(Optional.of(guide));
//when
Expand Down
12 changes: 0 additions & 12 deletions src/test/java/com/festival/domain/image/fixture/ImageFixture.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void updateProgram() throws Exception {
.endDate(registeredEndDate)
.build();
Program program = Program.of(programReq, LocalDate.now());
program.setImage(createImage());
program.connectMember(member);
Program savedProgram = programRepository.saveAndFlush(program);

Expand Down Expand Up @@ -603,4 +604,11 @@ private static MockHttpServletRequestBuilder makeMultiPartRequest(Program savedP
});
}

private Image createImage() {
return Image.builder()
.mainFilePath("/mainFile")
.subFilePaths(List.of("/subFile1", "/subFile2"))
.build();
}

}

0 comments on commit a5e704c

Please sign in to comment.