Spring Boot, Mockito, Unit Testing, Junit 5, Rest Api.
assertThat(e).isInstanceOf(RuntimeException.class); } } @Test public void BooksService_FindById_HandleException(){ when(this.booksRepository.findById(anyString())).thenThrow(RuntimeException.class); Books bookWithId = null; try { bookWithId = this.bookService.findById("test-234");