@Test
    void testFindByTitle() {
        String title = "Book C";
        ParameterizedTypeReference<List<Book>> typeRef = new ParameterizedTypeReference<>() {
        };

        // find Book C
        ResponseEntity<List<Book>> response = restTemplate.exchange(
                BASEURI + "/books/find/title/" + title,
                HttpMethod.GET,
                null,
                typeRef
        );

        // test response code
        assertEquals(HttpStatus.OK, response.getStatusCode());

        List<Book> list = response.getBody();
        assert list != null;

        assertEquals(1, list.size());

        // Test Book C details
        Book book = list.get(0);
        assertEquals("Book C", book.getTitle());
        assertEquals(BigDecimal.valueOf(29.99), book.getPrice());
        assertEquals(LocalDate.of(2023, 6, 10), book.getPublishDate());

    }
Testing with TestRestTemplate and @Testcontainers (image mysql:8.0-debian)
spring-data-jpa-mysql/src/test/java/com/mkyong/BookControllerTest.java