Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: stempo-application 모듈 테스트 코드 작성 #84

Merged
merged 43 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
836b61b
feat(Application): AuthenticatorConfig 테스트 코드 추가
limehee Oct 23, 2024
b56c0ce
feat(Application): AuthRequestDto 테스트 코드 추가
limehee Oct 23, 2024
714ab59
refactor(Convention): 코드 포매터 적용
limehee Oct 23, 2024
3c49e4e
feat(Application): BoardRequestDto 테스트 코드 추가
limehee Oct 23, 2024
12652d2
feat(Application): DeleteFileRequestDto 테스트 코드 추가
limehee Oct 23, 2024
2281add
feat(Application): HomeworkRequestDto 테스트 코드 추가
limehee Oct 23, 2024
866568b
feat(Application): RecordRequestDto 테스트 코드 추가
limehee Oct 23, 2024
9c52da0
feat(Application): RhythmRequestDto 테스트 코드 추가
limehee Oct 23, 2024
f53f09f
feat(Application): TwoFactorAuthenticationRequestDto 테스트 코드 추가
limehee Oct 23, 2024
c3804d4
feat(Application): BoardDtoMapper 테스트 코드 추가
limehee Oct 23, 2024
d4bae63
feat(Application): HomeworkDtoMapper 테스트 코드 추가
limehee Oct 23, 2024
9c37691
feat(Application): RecordDtoMapper 테스트 코드 추가
limehee Oct 23, 2024
2c800c4
feat(Application): UploadedFileDtoMapper 테스트 코드 추가
limehee Oct 23, 2024
8a73d94
feat(Application): UserEventDispatcher 테스트 코드 추가
limehee Oct 23, 2024
55cf079
feat(Application): UserDeletedEvent 테스트 코드 추가
limehee Oct 23, 2024
d3b7cb5
feat(Application): UserEventProcessorRegistry 테스트 코드 추가
limehee Oct 23, 2024
f8f5bb9
feat(Application): UserDeletedEvent 테스트 코드 수정
limehee Oct 23, 2024
9a0e94f
feat(Application): BoardEventProcessor 테스트 코드 추가
limehee Oct 23, 2024
0891b61
feat(Application): HomeworkEventProcessor 테스트 코드 추가
limehee Oct 23, 2024
e3594c0
feat(Application): RecordEventProcessor 테스트 코드 추가
limehee Oct 23, 2024
f656e7a
refactor(Auth): AuthServiceImpl SRP 적용, 포트-어댑터 + 커맨드 패턴 변경
limehee Oct 24, 2024
c344f9a
feat(Application): AuthenticationService 테스트 코드 추가
limehee Oct 24, 2024
86645be
feat(Application): TokenService 테스트 코드 추가
limehee Oct 24, 2024
638cb95
feat(Application): TotpService 테스트 코드 추가
limehee Oct 24, 2024
c6b4e2b
feat(Application): UserEventService 테스트 코드 추가
limehee Oct 24, 2024
eda3491
feat(Application): UserRegistrationService 테스트 코드 추가
limehee Oct 24, 2024
37e15a1
feat(Application): AuthServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
2f1256c
feat(Application): BoardServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
3045eca
feat(Application): HomeworkServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
cc0912b
feat(Application): RecordServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
8039c62
feat(Application): TotpAuthenticatorServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
61a26ee
feat(Application): UploadedFileServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
aa4b550
feat(Application): UserServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
a093d7f
feat(Application): UserRegistrationCommand 테스트 코드 추가
limehee Oct 24, 2024
19f20a0
feat(Application): LoginCommand 테스트 코드 추가
limehee Oct 24, 2024
ed4947e
feat(Application): RhythmServiceImpl 테스트 코드 추가
limehee Oct 24, 2024
cef9641
feat(Application): FileService 테스트 코드 추가
limehee Oct 24, 2024
463507a
refactor(Auth): 인증 로직 개선
limehee Oct 24, 2024
0d30e91
refactor(Test): Mockito 모의 객체 초기화 방법 변경
limehee Oct 24, 2024
6ff5060
fix(Test): Mockito 조작 변경 과정에서 깨진 테스트 수정
limehee Oct 24, 2024
fd6e9ab
fix(Test): Mockito 조작 변경 과정에서 깨진 테스트 수정
limehee Oct 24, 2024
c8d6693
fix(Test): Mockito 조작 변경 과정에서 깨진 테스트 수정
limehee Oct 24, 2024
7ca28ea
refactor(Test): 테스트 메소드명 수정
limehee Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
@Setter
public class AuthRequestDto {

@NotBlank(message = "deviceTag is required")
@Schema(description = "디바이스 식별자" , example = "490154203237518", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "DeviceTag is required")
@Schema(description = "디바이스 식별자", example = "490154203237518", requiredMode = Schema.RequiredMode.REQUIRED)
private String deviceTag;

@Schema(description = "비밀번호" , example = "password")
@Schema(description = "비밀번호", example = "password")
private String password;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
import com.stempo.model.BoardCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class BoardRequestDto {

@NotNull
@NotNull(message = "Category is required")
@Schema(description = "카테고리", example = "NOTICE", requiredMode = Schema.RequiredMode.REQUIRED)
private BoardCategory category;

@NotNull
@NotNull(message = "Title is required")
@Schema(description = "제목", example = "청각 자극을 통한 뇌성마비 환자 보행 패턴 개선 서비스, Stempo.", minLength = 1, maxLength = 100, requiredMode = Schema.RequiredMode.REQUIRED)
private String title;

@NotNull
@NotNull(message = "Content is required")
@Schema(description = "내용", example = "Stempo는 청각 자극을 통한 뇌성마비 환자 보행 패턴 개선 서비스입니다.", minLength = 1, maxLength = 10000, requiredMode = Schema.RequiredMode.REQUIRED)
private String content;

@Schema(description = "파일 링크(JSON Array)", example = """
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
private List<String> fileUrls;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import com.stempo.model.BoardCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class BoardUpdateRequestDto {
Expand All @@ -21,10 +20,10 @@ public class BoardUpdateRequestDto {
private String content;

@Schema(description = "파일 링크(JSON Array)", example = """
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
private List<String> fileUrls;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
public class RecordRequestDto {

@NotNull(message = "Accuracy is required")
@PositiveOrZero(message = "Accuracy must be a positive value or zero")
@Range(min = 0, max = 100, message = "Accuracy must be between 0 and 100")
@Schema(description = "정확도", example = "0.0", minimum = "0.0", maximum = "100.0", requiredMode = Schema.RequiredMode.REQUIRED)
private Double accuracy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import com.stempo.model.BoardCategory;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Builder;
import lombok.Getter;

import java.util.List;

@Getter
@Builder
public class BoardResponseDto {
Expand All @@ -27,11 +26,11 @@ public class BoardResponseDto {
private String content;

@Schema(description = "파일 링크(JSON Array)", example = """
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
[
"/resources/files/947051880039041_19dea234-b6ec-4c4b-bc92-c53c0d921943.wav",
"/resources/files/boards/1/1030487120626166_1dec3611-c148-4139-bb16-3d2a89ac1dd7.pdf"
]
""")
private List<String> fileUrls;

@Schema(description = "생성일시", example = "2024-01-01T00:00:00")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.stempo.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDate;

@Getter
@Builder
public class RecordResponseDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RecordStatisticsResponseDto {
@Schema(description = "오늘 보행 훈련 횟수", example = "0")
private int todayWalkTrainingCount;

@Schema(description = "이번 주 보행 훈련 횟수", example = "0")
@Schema(description = "주간 보행 훈련 횟수", example = "0")
private int weeklyWalkTrainingCount;

@Schema(description = "연속 보행 훈련 일수", example = "0")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.stempo.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDateTime;

@Getter
@Builder
public class UploadedFileResponseDto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import com.stempo.model.Board;
import com.stempo.repository.BoardRepository;
import jakarta.annotation.PostConstruct;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
@RequiredArgsConstructor
public class BoardEventProcessor implements UserEventProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import com.stempo.model.Homework;
import com.stempo.repository.HomeworkRepository;
import jakarta.annotation.PostConstruct;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
@RequiredArgsConstructor
public class HomeworkEventProcessor implements UserEventProcessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import com.stempo.model.Record;
import com.stempo.repository.RecordRepository;
import jakarta.annotation.PostConstruct;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
@RequiredArgsConstructor
public class RecordEventProcessor implements UserEventProcessor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.stempo.event;

import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@RequiredArgsConstructor
public class UserEventDispatcher {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.stempo.event;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.stereotype.Component;

@Component
public class UserEventProcessorRegistry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.stempo.dto.ErrorResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.CompletionException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.query.sqm.UnknownPathException;
Expand All @@ -12,9 +14,6 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.io.IOException;
import java.util.concurrent.CompletionException;

@RestControllerAdvice(basePackages = "com.stempo")
@RequiredArgsConstructor
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import com.stempo.dto.request.BoardUpdateRequestDto;
import com.stempo.dto.response.BoardResponseDto;
import com.stempo.model.Board;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import org.springframework.stereotype.Component;

@Component
public class BoardDtoMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import com.stempo.dto.response.RecordResponseDto;
import com.stempo.dto.response.RecordStatisticsResponseDto;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import org.springframework.stereotype.Component;

@Component
public class RecordDtoMapper {
Expand All @@ -18,7 +17,8 @@ public RecordResponseDto toDto(Double accuracy, Integer duration, Integer steps,
.build();
}

public RecordStatisticsResponseDto toDto(int todayWalkTrainingCount, int weeklyWalkTrainingCount, int consecutiveWalkTrainingDays) {
public RecordStatisticsResponseDto toDto(int todayWalkTrainingCount, int weeklyWalkTrainingCount,
int consecutiveWalkTrainingDays) {
return RecordStatisticsResponseDto.builder()
.todayWalkTrainingCount(todayWalkTrainingCount)
.weeklyWalkTrainingCount(weeklyWalkTrainingCount)
Expand Down
Loading