// Path: src/test/java/com/github/arteam/jdit/domain/PlayerSqlObject.java
// @RegisterRowMapper(PlayerSqlObject.PlayerMapper.class)
// public interface PlayerSqlObject {
// 
//     @GetGeneratedKeys
//     @SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
//             "(:first_name, :last_name, :birth_date, :weight, :height)")
//     Long createPlayer(@Bind("first_name") String firstName, @Bind("last_name") String lastName,
//                       @Bind("birth_date") Date birthDate, @Bind("height") int height,
//                       @Bind("weight") int weight);
// 
//     @GetGeneratedKeys
//     @SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
//             "(:first_name, :last_name, :birth_date, :weight, :height)")
//     Long createPlayer(@PlayerBinder Player player);
// 
//     @SqlQuery("select last_name from players order by last_name")
//     List<String> getLastNames();
// 
//     @SqlQuery("select count(*) from players where extract(year from birth_date) = :year")
//     int getAmountPlayersBornInYear(@Bind("year") int year);
// 
//     @SqlQuery("select * from players where birth_date > :date")
//     List<Player> getPlayersBornAfter(@Bind("date") DateTime date);
// 
//     @SqlQuery("select birth_date from players where first_name=:first_name and last_name=:last_name")
//     DateTime getPlayerBirthDate(@Bind("first_name") String firstName, @Bind("last_name") String lastName);
// 
//     @SqlQuery("select distinct extract(year from birth_date) player_year from players order by player_year")
//     Set<Integer> getBornYears();
// 
//     @SqlQuery("select * from players where first_name=:first_name and last_name=:last_name")
//     Optional<Player> findPlayer(@Bind("first_name") String firstName, @Bind("last_name") String lastName);
// 
//     @SqlQuery("select * from players where weight <> :weight")
//     List<Player> getPlayersByWeight(@Bind("weight") Optional<Integer> weight);
// 
//     @SqlQuery("select first_name from players")
//     ImmutableSet<String> getFirstNames();
// 
//     @Retention(RetentionPolicy.RUNTIME)
//     @Target({ElementType.PARAMETER})
//     @SqlStatementCustomizingAnnotation(PlayerBinder.Factory.class)
//     @interface PlayerBinder {
// 
//         class Factory implements SqlStatementCustomizerFactory {
// 
//             @Override
//             public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType,
//                                                                       Method method, Parameter param, int index,
//                                                                       Type type) {
//                 return (stmt, arg) -> {
//                     Player p = (Player) arg;
//                     stmt.bind("first_name", p.firstName);
//                     stmt.bind("last_name", p.lastName);
//                     stmt.bind("birth_date", p.birthDate);
//                     stmt.bind("weight", p.weight);
//                     stmt.bind("height", p.height);
//                 };
//             }
//         }
//     }
// 
//     class PlayerMapper implements RowMapper<Player> {
//         @Override
//         public Player map(ResultSet r, StatementContext ctx) throws SQLException {
//             int height = r.getInt("height");
//             int weight = r.getInt("weight");
//             return new Player(Optional.of(r.getLong("id")), r.getString("first_name"), r.getString("last_name"),
//                     r.getTimestamp("birth_date"),
//                     height != 0 ? Optional.of(height) : Optional.empty(),
//                     weight != 0 ? Optional.of(weight) : Optional.empty());
//         }
//     }
// }
// 
// Path: src/test/java/com/github/arteam/jdit/domain/entity/Player.java
// public class Player {
// 
//     public final Optional<Long> id;
//     public final String firstName;
//     public final String lastName;
//     public final Date birthDate;
//     public final Optional<Integer> height;
//     public final Optional<Integer> weight;
// 
//     public Player(Optional<Long> id, String firstName, String lastName, Date birthDate,
//                   Optional<Integer> height, Optional<Integer> weight) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.birthDate = birthDate;
//         this.height = height;
//         this.weight = weight;
//     }
// 
//     public Player(String firstName, String lastName, Date birthDate, int height, int weight) {
//         this(Optional.<Long>empty(), firstName, lastName, birthDate, Optional.of(height), Optional.of(weight));
//     }
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .omitNullValues()
//                 .add("id", id.orElse(null))
//                 .add("firstName", firstName)
//                 .add("lastName", lastName)
//                 .add("birthDate", birthDate)
//                 .add("height", height.orElse(null))
//                 .add("weight", weight.orElse(null))
//                 .toString();
//     }
// }


import com.github.arteam.jdit.annotations.DataSet;
import com.github.arteam.jdit.annotations.TestedSqlObject;
import com.github.arteam.jdit.domain.PlayerSqlObject;
import com.github.arteam.jdit.domain.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
package com.github.arteam.jdit;




@RunWith(DBIRunner.class)
@DataSet("playerDao/players.sql")
public class TestOptionals {

    @TestedSqlObject
// Path: src/test/java/com/github/arteam/jdit/domain/PlayerSqlObject.java
// @RegisterRowMapper(PlayerSqlObject.PlayerMapper.class)
// public interface PlayerSqlObject {
// 
//     @GetGeneratedKeys
//     @SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
//             "(:first_name, :last_name, :birth_date, :weight, :height)")
//     Long createPlayer(@Bind("first_name") String firstName, @Bind("last_name") String lastName,
//                       @Bind("birth_date") Date birthDate, @Bind("height") int height,
//                       @Bind("weight") int weight);
// 
//     @GetGeneratedKeys
//     @SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
//             "(:first_name, :last_name, :birth_date, :weight, :height)")
//     Long createPlayer(@PlayerBinder Player player);
// 
//     @SqlQuery("select last_name from players order by last_name")
//     List<String> getLastNames();
// 
//     @SqlQuery("select count(*) from players where extract(year from birth_date) = :year")
//     int getAmountPlayersBornInYear(@Bind("year") int year);
// 
//     @SqlQuery("select * from players where birth_date > :date")
//     List<Player> getPlayersBornAfter(@Bind("date") DateTime date);
// 
//     @SqlQuery("select birth_date from players where first_name=:first_name and last_name=:last_name")
//     DateTime getPlayerBirthDate(@Bind("first_name") String firstName, @Bind("last_name") String lastName);
// 
//     @SqlQuery("select distinct extract(year from birth_date) player_year from players order by player_year")
//     Set<Integer> getBornYears();
// 
//     @SqlQuery("select * from players where first_name=:first_name and last_name=:last_name")
//     Optional<Player> findPlayer(@Bind("first_name") String firstName, @Bind("last_name") String lastName);
// 
//     @SqlQuery("select * from players where weight <> :weight")
//     List<Player> getPlayersByWeight(@Bind("weight") Optional<Integer> weight);
// 
//     @SqlQuery("select first_name from players")
//     ImmutableSet<String> getFirstNames();
// 
//     @Retention(RetentionPolicy.RUNTIME)
//     @Target({ElementType.PARAMETER})
//     @SqlStatementCustomizingAnnotation(PlayerBinder.Factory.class)
//     @interface PlayerBinder {
// 
//         class Factory implements SqlStatementCustomizerFactory {
// 
//             @Override
//             public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType,
//                                                                       Method method, Parameter param, int index,
//                                                                       Type type) {
//                 return (stmt, arg) -> {
//                     Player p = (Player) arg;
//                     stmt.bind("first_name", p.firstName);
//                     stmt.bind("last_name", p.lastName);
//                     stmt.bind("birth_date", p.birthDate);
//                     stmt.bind("weight", p.weight);
//                     stmt.bind("height", p.height);
//                 };
//             }
//         }
//     }
// 
//     class PlayerMapper implements RowMapper<Player> {
//         @Override
//         public Player map(ResultSet r, StatementContext ctx) throws SQLException {
//             int height = r.getInt("height");
//             int weight = r.getInt("weight");
//             return new Player(Optional.of(r.getLong("id")), r.getString("first_name"), r.getString("last_name"),
//                     r.getTimestamp("birth_date"),
//                     height != 0 ? Optional.of(height) : Optional.empty(),
//                     weight != 0 ? Optional.of(weight) : Optional.empty());
//         }
//     }
// }
// 
// Path: src/test/java/com/github/arteam/jdit/domain/entity/Player.java
// public class Player {
// 
//     public final Optional<Long> id;
//     public final String firstName;
//     public final String lastName;
//     public final Date birthDate;
//     public final Optional<Integer> height;
//     public final Optional<Integer> weight;
// 
//     public Player(Optional<Long> id, String firstName, String lastName, Date birthDate,
//                   Optional<Integer> height, Optional<Integer> weight) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//         this.birthDate = birthDate;
//         this.height = height;
//         this.weight = weight;
//     }
// 
//     public Player(String firstName, String lastName, Date birthDate, int height, int weight) {
//         this(Optional.<Long>empty(), firstName, lastName, birthDate, Optional.of(height), Optional.of(weight));
//     }
// 
//     @Override
//     public String toString() {
//         return MoreObjects.toStringHelper(this)
//                 .omitNullValues()
//                 .add("id", id.orElse(null))
//                 .add("firstName", firstName)
//                 .add("lastName", lastName)
//                 .add("birthDate", birthDate)
//                 .add("height", height.orElse(null))
//                 .add("weight", weight.orElse(null))
//                 .toString();
//     }
// }


// Path: src/test/java/com/github/arteam/jdit/TestOptionals.java
import com.github.arteam.jdit.annotations.DataSet;
import com.github.arteam.jdit.annotations.TestedSqlObject;
import com.github.arteam.jdit.domain.PlayerSqlObject;
import com.github.arteam.jdit.domain.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;

package com.github.arteam.jdit;




@RunWith(DBIRunner.class)
@DataSet("playerDao/players.sql")
public class TestOptionals {

    @TestedSqlObject
    PlayerSqlObject playerSqlObject;