|
6 | 6 | import jakarta.validation.constraints.NotNull;
|
7 | 7 | import lombok.extern.slf4j.Slf4j;
|
8 | 8 | import org.ays.AysRestControllerTest;
|
9 |
| -import org.ays.auth.util.exception.AysUserNotSuperAdminException; |
10 | 9 | import org.ays.common.model.response.AysErrorResponse;
|
11 | 10 | import org.ays.common.util.exception.AysAuthException;
|
12 | 11 | import org.ays.common.util.exception.AysBadRequestException;
|
|
15 | 14 | import org.junit.jupiter.api.Assertions;
|
16 | 15 | import org.junit.jupiter.api.Test;
|
17 | 16 | import org.mockito.InjectMocks;
|
18 |
| -import org.mockito.Mockito; |
19 | 17 | import org.springframework.core.MethodParameter;
|
20 | 18 | import org.springframework.dao.DataAccessException;
|
21 | 19 | import org.springframework.http.HttpInputMessage;
|
@@ -360,38 +358,4 @@ private void checkAysError(AysErrorResponse mockErrorResponse, AysErrorResponse
|
360 | 358 |
|
361 | 359 | }
|
362 | 360 |
|
363 |
| - @Test |
364 |
| - void givenUserNotSuperAdmin_whenThrowAysUserNotSuperAdminException_thenReturnAysError() { |
365 |
| - // Given |
366 |
| - AysUserNotSuperAdminException mockException = Mockito.mock(AysUserNotSuperAdminException.class); |
367 |
| - Mockito.when(mockException.getMessage()).thenReturn("User is not a super admin"); |
368 |
| - |
369 |
| - // When |
370 |
| - AysErrorResponse mockErrorResponse = AysErrorResponse.builder() |
371 |
| - .header(AysErrorResponse.Header.AUTH_ERROR.getName()) |
372 |
| - .message(mockException.getMessage()) |
373 |
| - .build(); |
374 |
| - |
375 |
| - // Then |
376 |
| - AysErrorResponse errorResponse = globalExceptionHandler.handleAysUserNotSuperAdminError(mockException); |
377 |
| - this.checkAysError(mockErrorResponse, errorResponse); |
378 |
| - } |
379 |
| - |
380 |
| - @Test |
381 |
| - void givenUserNotSuperAdmin_whenThrowAysUserNotSuperAdminExceptionWithoutMessage_thenReturnAysError() { |
382 |
| - // Given |
383 |
| - AysUserNotSuperAdminException mockException = Mockito.mock(AysUserNotSuperAdminException.class); |
384 |
| - Mockito.when(mockException.getMessage()).thenReturn(null); |
385 |
| - |
386 |
| - // When |
387 |
| - AysErrorResponse mockErrorResponse = AysErrorResponse.builder() |
388 |
| - .header(AysErrorResponse.Header.AUTH_ERROR.getName()) |
389 |
| - .message(null) |
390 |
| - .build(); |
391 |
| - |
392 |
| - // Then |
393 |
| - AysErrorResponse errorResponse = globalExceptionHandler.handleAysUserNotSuperAdminError(mockException); |
394 |
| - this.checkAysError(mockErrorResponse, errorResponse); |
395 |
| - } |
396 |
| - |
397 | 361 | }
|
0 commit comments