Skip to content

Commit

Permalink
Added test case for IllegalArgumentException
Browse files Browse the repository at this point in the history
  • Loading branch information
K4sik committed Oct 1, 2024
1 parent e8bb312 commit 23ac181
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ void testHandleBadRefreshTokenException() {
ResponseEntity.status(HttpStatus.BAD_REQUEST).body(exceptionResponse));
}

@Test
void testHandleIllegalTokenException() {
IllegalArgumentException illegalArgumentException = new IllegalArgumentException("test");
ExceptionResponse exceptionResponse = new ExceptionResponse(objectMap);
when(errorAttributes.getErrorAttributes(eq(webRequest),
any(ErrorAttributeOptions.class))).thenReturn(objectMap);
assertEquals(customExceptionHandler.handleIllegalArgumentException(illegalArgumentException, webRequest),
ResponseEntity.status(HttpStatus.BAD_REQUEST).body(exceptionResponse));
}

@Test
void handleBadRequestException() {
BadRequestException badRequestException = new BadRequestException("test");
Expand Down

0 comments on commit 23ac181

Please sign in to comment.