Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -8,6 +8,7 @@
import org.springframework.security.access.AccessDeniedException; // 추가
import org.springframework.security.authorization.AuthorizationDeniedException; // 추가
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
Expand Down Expand Up @@ -40,6 +41,7 @@ public ResponseEntity<ApiResponse<Void>> handleValidation(MethodArgumentNotValid
@ExceptionHandler({
HttpMessageNotReadableException.class,
MethodArgumentTypeMismatchException.class,
MissingServletRequestParameterException.class,
ConstraintViolationException.class,
IllegalArgumentException.class
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ void recordImpressions_accumulatesIntoSameDailyRow() throws Exception {
.isEqualTo(2L);
}

@Test
@DisplayName("필수 파라미터가 빠지면 500이 아니라 400을 준다")
void findAds_missingRequiredParamIsBadRequest() throws Exception {
// 전역 핸들러가 MissingServletRequestParameterException 을 잡지 못해 500 으로 새던 자리다.
// 광고 전용 문제가 아니라 필수 쿼리 파라미터를 쓰는 모든 API 가 같이 영향을 받는다.
mockMvc.perform(get("/api/v1/ads"))
.andExpect(status().isBadRequest());
}

@Test
@DisplayName("노출 집계는 한 번에 밀어 넣을 수 있는 소재 수를 제한한다")
void recordImpressions_rejectsOversizedBatch() throws Exception {
Expand Down
Loading