-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix masterIntroduce & Introduce Test
- Loading branch information
Showing
2 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import jakarta.transaction.Transactional; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
@@ -16,6 +17,20 @@ | |
import umc.kkijuk.server.introduce.domain.MasterIntroduceRepository; | ||
import umc.kkijuk.server.introduce.dto.MasterIntroduceReqDto; | ||
import umc.kkijuk.server.introduce.service.MasterIntroduceService; | ||
import umc.kkijuk.server.member.domain.MarketingAgree; | ||
import umc.kkijuk.server.member.domain.Member; | ||
import umc.kkijuk.server.member.domain.State; | ||
import umc.kkijuk.server.member.dto.MemberJoinDto; | ||
import umc.kkijuk.server.member.service.MemberService; | ||
import umc.kkijuk.server.recruit.domain.Recruit; | ||
import umc.kkijuk.server.recruit.domain.RecruitStatus; | ||
import umc.kkijuk.server.recruit.infrastructure.RecruitEntity; | ||
import umc.kkijuk.server.recruit.service.port.RecruitRepository; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; | ||
|
@@ -34,10 +49,22 @@ class MasterIntroduceControllerTest { | |
@Autowired | ||
private MockMvc mockMvc; | ||
@Autowired | ||
private MasterIntroduceService masterIntroduceService; | ||
private RecruitRepository recruitRepository; | ||
@Autowired | ||
private ObjectMapper objectMapper; | ||
|
||
@Autowired | ||
private MemberService memberService; | ||
|
||
private Member requestMember; | ||
|
||
@BeforeEach | ||
public void Init() { | ||
MemberJoinDto memberJoinDto = new MemberJoinDto("[email protected]", "홍길동", "010-7444-1768", LocalDate.parse("1999-03-31"), "passwordTest", "passwordTest", MarketingAgree.BOTH, State.ACTIVATE); | ||
requestMember = memberService.join(memberJoinDto); | ||
|
||
} | ||
|
||
@Test | ||
@DisplayName("마스터 자기소개서 생성 테스트") | ||
public void postMaster() throws Exception{ | ||
|
@@ -47,6 +74,8 @@ public void postMaster() throws Exception{ | |
final String prosAndCons="prosAndCons-test"; | ||
final String jobSuitability="jobSuitability-test"; | ||
|
||
System.out.println(requestMember.getId()); | ||
|
||
MasterIntroduceReqDto masterIntroduceReqDto= MasterIntroduceReqDto.builder() | ||
.oneLiner(oneLiner) | ||
.introduction(introduction) | ||
|
@@ -55,7 +84,6 @@ public void postMaster() throws Exception{ | |
.jobSuitability(jobSuitability) | ||
.build(); | ||
|
||
|
||
mockMvc.perform(post("/history/intro/master") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(objectMapper.writeValueAsString(masterIntroduceReqDto))) | ||
|
@@ -77,6 +105,7 @@ public void updateMaster() throws Exception { | |
final String jobSuitability="jobSuitability-test"; | ||
|
||
MasterIntroduce masterIntroduce = masterIntroduceRepository.save(MasterIntroduce.builder() | ||
.member(requestMember) | ||
.oneLiner(oneLiner) | ||
.introduction(introduction) | ||
.motive(motive) | ||
|
@@ -97,7 +126,7 @@ public void updateMaster() throws Exception { | |
.introduction(expectedIntroduce) | ||
.motive(expectedMotivate) | ||
.prosAndCons(expectedPnC) | ||
.jobSuitability(jobSuitability) | ||
.jobSuitability(expectedJS) | ||
.build(); | ||
|
||
mockMvc.perform(patch("/history/intro/master") | ||
|
@@ -109,6 +138,6 @@ public void updateMaster() throws Exception { | |
.andExpect(jsonPath("$.data.introduction").value(expectedIntroduce)) | ||
.andExpect(jsonPath("$.data.motive").value(expectedMotivate)) | ||
.andExpect(jsonPath("$.data.prosAndCons").value(expectedPnC)) | ||
.andExpect(jsonPath("$.data.jobSuitability").value(jobSuitability)); | ||
.andExpect(jsonPath("$.data.jobSuitability").value(expectedJS)); | ||
} | ||
} |