Skip to content

Commit

Permalink
test: 사용하지 않는 테스트 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoding-play committed Nov 28, 2024
1 parent 6cf6859 commit f62e454
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
7 changes: 7 additions & 0 deletions backend/src/main/java/corea/room/domain/RoomSortStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public enum RoomSortStrategy {
private final String property;
private final Sort.Direction direction;

public static RoomSortStrategy from(RoomStatus status) {
if (status.isClosed()) {
return RoomSortStrategy.REVIEW_DEADLINE_DESC;
}
return RoomSortStrategy.RECRUITMENT_DEADLINE_DESC;
}

public Sort toSort() {
return Sort.by(direction, property);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ public class RoomInquiryService {
private final RoomRepository roomRepository;
private final ParticipationRepository participationRepository;
private final RoomMatchReader roomMatchReader;
private final RoomSortStrategyFactory roomSortStrategyFactory;

public RoomSearchResponses search(long memberId, RoomStatus status, RoomClassification classification, String keywordTitle) {
Specification<Room> spec = getSearchSpecification(status, classification, keywordTitle);
RoomSortStrategy roomSortStrategy = roomSortStrategyFactory.getRoomSortStrategy(status);
RoomSortStrategy roomSortStrategy = RoomSortStrategy.from(status);
List<Room> rooms = roomReader.findAll(spec, roomSortStrategy);

List<RoomResponse> roomResponses = getRoomResponses(rooms, memberId);
Expand All @@ -60,7 +59,7 @@ public RoomResponses findRoomsWithRoomStatus(long memberId, int pageNumber, Stri

private Page<Room> getPaginatedRooms(int pageNumber, String expression, RoomStatus status) {
RoomClassification classification = RoomClassification.from(expression);
RoomSortStrategy roomSortStrategy = roomSortStrategyFactory.getRoomSortStrategy(status);
RoomSortStrategy roomSortStrategy = RoomSortStrategy.from(status);
PageRequest pageRequest = PageRequest.of(pageNumber, PAGE_DISPLAY_SIZE, roomSortStrategy.toSort());

if (classification.isAll()) {
Expand All @@ -78,7 +77,7 @@ private List<RoomResponse> getRoomResponses(List<Room> rooms, long memberId) {
private RoomResponse getRoomResponse(Room room, long memberId) {
boolean isPublic = roomMatchReader.isPublicRoom(room);
return participationRepository.findByRoomIdAndMemberId(room.getId(), memberId)
.map(participation -> RoomResponse.of(room, participation,isPublic))
.orElseGet(() -> RoomResponse.of(room, MemberRole.NONE, ParticipationStatus.NOT_PARTICIPATED,isPublic));
.map(participation -> RoomResponse.of(room, participation, isPublic))
.orElseGet(() -> RoomResponse.of(room, MemberRole.NONE, ParticipationStatus.NOT_PARTICIPATED, isPublic));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

import static org.assertj.core.api.Assertions.assertThat;

class RoomSortStrategyFactoryTest {
class RoomSortStrategyTest {

@ParameterizedTest
@CsvSource(value = {"OPEN, RECRUITMENT_DEADLINE_DESC", "CLOSE, REVIEW_DEADLINE_DESC"})
@DisplayName("방 상태에 따라 방 정렬 방식을 얻을 수 있다.")
void getRoomSortStrategy(RoomStatus status, RoomSortStrategy expected) {
RoomSortStrategyFactory roomSortStrategyFactory = new RoomSortStrategyFactory();

RoomSortStrategy actual = roomSortStrategyFactory.getRoomSortStrategy(status);
void from(RoomStatus status, RoomSortStrategy expected) {
RoomSortStrategy actual = RoomSortStrategy.from(status);

assertThat(actual).isEqualTo(expected);
}
Expand Down

0 comments on commit f62e454

Please sign in to comment.