@Override
  public Optional<Product> findByName(String name) throws SQLException {
    var sql = "select * from PRODUCTS where name = ?;";

    try (var connection = dataSource.getConnection();
        var preparedStatement = connection.prepareStatement(sql)) {
      preparedStatement.setString(1, name);

      ResultSet rs = preparedStatement.executeQuery();

      if (rs.next()) {
        return Optional.of(
            Product.builder()
                .name(rs.getString("name"))
                .price(Money.of(USD, rs.getBigDecimal("price")))
                .expirationDate(rs.getDate("expiration_date").toLocalDate())
                .productDao(this)
                .build());
      } else {
        return Optional.empty();
      }
    }
  }
@Test
    void shouldFindProductByName() throws SQLException {
        var product = productDao.findByName("product");

        assertTrue(product.isEmpty());

        TestUtils.executeSQL(INSERT_PRODUCT_SQL, dataSource);

        product = productDao.findByName("product");

        assertTrue(product.isPresent());
        assertEquals("product", product.get().getName());
        assertEquals(Money.of(USD, 100), product.get().getPrice());
        assertEquals(LocalDate.parse("2021-06-27"), product.get().getExpirationDate());
    }