-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Test] : 내가 신청한 스터디 목록 조회 기능 통합 테스트 구현
- Loading branch information
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/kr/co/studyhubinu/studyhubserver/apply/dto/data/RequestApplyData.java
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package kr.co.studyhubinu.studyhubserver.apply.dto.data; | ||
|
||
import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RequestApplyData { | ||
|
||
private final Long studyId; | ||
private final String studyTitle; | ||
private final Inspection inspection; | ||
private final String introduce; | ||
|
||
public RequestApplyData(Long studyId, String studyTitle, Inspection inspection, String introduce) { | ||
this.studyId = studyId; | ||
this.studyTitle = studyTitle; | ||
this.inspection = inspection; | ||
this.introduce = introduce; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../java/kr/co/studyhubinu/studyhubserver/apply/dto/response/FindMyRequestApplyResponse.java
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package kr.co.studyhubinu.studyhubserver.apply.dto.response; | ||
|
||
import kr.co.studyhubinu.studyhubserver.apply.dto.data.ParticipateApplyData; | ||
import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData; | ||
import lombok.Getter; | ||
import org.springframework.data.domain.Slice; | ||
|
||
@Getter | ||
public class FindMyRequestApplyResponse { | ||
|
||
private Long totalCount; | ||
Slice<RequestApplyData> requestStudyData; | ||
|
||
public FindMyRequestApplyResponse(Long totalCount, Slice<RequestApplyData> requestStudyData) { | ||
this.totalCount = totalCount; | ||
this.requestStudyData = requestStudyData; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...test/java/kr/co/studyhubinu/studyhubserver/apply/service/ApplyServiceIntegrationTest.java
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package kr.co.studyhubinu.studyhubserver.apply.service; | ||
|
||
import kr.co.studyhubinu.studyhubserver.apply.domain.ApplyEntity; | ||
import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData; | ||
import kr.co.studyhubinu.studyhubserver.apply.dto.response.FindMyRequestApplyResponse; | ||
import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection; | ||
import kr.co.studyhubinu.studyhubserver.apply.repository.ApplyRepository; | ||
import kr.co.studyhubinu.studyhubserver.study.domain.StudyEntity; | ||
import kr.co.studyhubinu.studyhubserver.study.repository.StudyRepository; | ||
import kr.co.studyhubinu.studyhubserver.support.fixture.StudyEntityFixture; | ||
import kr.co.studyhubinu.studyhubserver.support.fixture.UserEntityFixture; | ||
import kr.co.studyhubinu.studyhubserver.user.domain.UserEntity; | ||
import kr.co.studyhubinu.studyhubserver.user.dto.data.UserId; | ||
import kr.co.studyhubinu.studyhubserver.user.repository.UserRepository; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest | ||
public class ApplyServiceIntegrationTest { | ||
|
||
@Autowired | ||
ApplyService applyService; | ||
|
||
@Autowired | ||
UserRepository userRepository; | ||
|
||
@Autowired | ||
ApplyRepository applyRepository; | ||
|
||
@Autowired | ||
StudyRepository studyRepository; | ||
|
||
@Test | ||
void 내가_신청한_스터디목록_조회() { | ||
UserEntity user = UserEntityFixture.YEONGJAE.UserEntity_생성(); | ||
StudyEntity study = studyRepository.save(StudyEntityFixture.INU.studyEntity_생성()); | ||
userRepository.save(user); | ||
applyRepository.save(ApplyEntity.builder() | ||
.userId(user.getId()).introduce("안녕") | ||
.studyId(study.getId()) | ||
.inspection(Inspection.ACCEPT) | ||
.build()); | ||
|
||
|
||
FindMyRequestApplyResponse applyResponse = applyService.getMyRequestApply(new UserId(user.getId()), 0, 3); | ||
RequestApplyData applyData = applyResponse.getRequestStudyData().getContent().get(0); | ||
|
||
assertThat(applyData.getInspection()).isEqualTo(Inspection.ACCEPT); | ||
assertThat(applyData.getIntroduce()).isEqualTo("안녕"); | ||
|
||
} | ||
} |
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