Skip to content

Commit a04afbd

Browse files
committed
test(recruit-board): 테스트 코드 수정
1 parent 3ee132e commit a04afbd

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/test/java/com/somemore/recruitboard/service/command/CreateRecruitBoardServiceTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.somemore.recruitboard.domain.VolunteerType;
1111
import com.somemore.recruitboard.dto.request.RecruitBoardCreateRequestDto;
1212
import com.somemore.recruitboard.repository.RecruitBoardJpaRepository;
13+
import com.somemore.recruitboard.repository.RecruitBoardRepository;
1314
import java.math.BigDecimal;
1415
import java.time.LocalDateTime;
1516
import java.util.Optional;
@@ -27,6 +28,9 @@ class CreateRecruitBoardServiceTest extends IntegrationTestSupport {
2728
@Autowired
2829
private RecruitBoardJpaRepository recruitBoardJpaRepository;
2930

31+
@Autowired
32+
private RecruitBoardRepository recruitBoardRepository;
33+
3034
@Autowired
3135
private LocationRepository locationRepository;
3236

@@ -68,7 +72,7 @@ void createRecruitBoardWithDto() {
6872
Long saveId = createRecruitBoardService.createRecruitBoard(dto, centerId, imgUrl);
6973

7074
// then
71-
Optional<RecruitBoard> recruitBoard = recruitBoardJpaRepository.findById(saveId);
75+
Optional<RecruitBoard> recruitBoard = recruitBoardRepository.findById(saveId);
7276

7377
assertThat(recruitBoard).isPresent();
7478
assertThat(recruitBoard.get().getId()).isEqualTo(saveId);

src/test/java/com/somemore/recruitboard/service/command/UpdateRecruitBoardServiceTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.somemore.recruitboard.dto.request.RecruitBoardLocationUpdateRequestDto;
1818
import com.somemore.recruitboard.dto.request.RecruitBoardUpdateRequestDto;
1919
import com.somemore.recruitboard.repository.RecruitBoardJpaRepository;
20+
import com.somemore.recruitboard.repository.RecruitBoardRepository;
2021
import java.math.BigDecimal;
2122
import java.time.LocalDateTime;
2223
import java.util.UUID;
@@ -35,6 +36,9 @@ class UpdateRecruitBoardServiceTest extends IntegrationTestSupport {
3536
@Autowired
3637
private RecruitBoardJpaRepository recruitBoardJpaRepository;
3738

39+
@Autowired
40+
private RecruitBoardRepository recruitBoardRepository;
41+
3842
@Autowired
3943
private LocationRepository locationRepository;
4044

@@ -78,7 +82,7 @@ void updateRecruitBoard() {
7882
newImgUrl);
7983

8084
// then
81-
RecruitBoard updatedRecruitBoard = recruitBoardJpaRepository.findById(recruitBoard.getId())
85+
RecruitBoard updatedRecruitBoard = recruitBoardRepository.findById(recruitBoard.getId())
8286
.orElseThrow();
8387

8488
assertThat(updatedRecruitBoard.getTitle()).isEqualTo(dto.title());
@@ -111,7 +115,7 @@ void updateRecruitBoardLocation() {
111115
updateRecruitBoardService.updateRecruitBoardLocation(dto, recruitBoard.getId(), centerId);
112116

113117
// then
114-
RecruitBoard updateRecruitBoard = recruitBoardJpaRepository.findById(recruitBoard.getId())
118+
RecruitBoard updateRecruitBoard = recruitBoardRepository.findById(recruitBoard.getId())
115119
.orElseThrow();
116120
Location updateLocation = locationRepository.findById(recruitBoard.getLocationId())
117121
.orElseThrow();
@@ -164,7 +168,7 @@ void updateRecruitBoardStatus() {
164168
currentDateTime);
165169

166170
// then
167-
RecruitBoard findBoard = recruitBoardJpaRepository.findById(recruitBoardId).orElseThrow();
171+
RecruitBoard findBoard = recruitBoardRepository.findById(recruitBoardId).orElseThrow();
168172
assertThat(findBoard.getRecruitStatus()).isEqualTo(newStatus);
169173
}
170174

0 commit comments

Comments
 (0)