Spring Boot, Mockito, Unit Testing, Junit 5, Rest Api.
@Test public void BooksService_FindById_ReturnsNoRecord(){ when(this.booksRepository.findById(anyString())).thenReturn(Optional.empty()); Books bookWithId = null; try { bookWithId = this.bookService.findById("test-234"); assertThat(bookWithId.getId()).isNull(); } catch (Exception e) {