// Path: src/test/java/com/github/arteam/jdit/domain/AdvancedPlayerSqlObject.java
// @RegisterRowMapper(AdvancedPlayerSqlObject.PlayerMapper.class)
// @UseStringTemplateSqlLocator
// public interface AdvancedPlayerSqlObject {
// 
//     @SqlQuery
//     List<Player> getPlayers(@Define("isFirstName") boolean isFirstName, @Bind("firstName") String firstName,
//                             @Define("isFirstName") boolean isLastName, @Bind("lastName") String lastName,
//                             @Define("isSort") boolean isSort, @Define("sortBy") String sortBy,
//                             @Define("isSortDesc") boolean isSortDesc,
//                             @Define("isLimit") boolean isLimit, @Define("limit") int limit,
//                             @Define("isOffset") boolean isOffset, @Define("offset") int offset);
// 
//     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.JditProperties;
import com.github.arteam.jdit.annotations.TestedSqlObject;
import com.github.arteam.jdit.domain.AdvancedPlayerSqlObject;
import com.github.arteam.jdit.domain.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
package com.github.arteam.jdit;




@RunWith(DBIRunner.class)
@JditProperties("jdit-h2.properties")
public class SqlLocatorTest {

    @TestedSqlObject
    AdvancedPlayerSqlObject playerDao;

    @Test
    @DataSet("playerDao/players.sql")
    public void getPlayerBySeveralAtributes() {
        List<Player> players = playerDao.getPlayers(true, "John", true, "Tavares", true, "last_name", true,
                true, 3, true, 0);
        assertThat(players).hasSize(1);
// Path: src/test/java/com/github/arteam/jdit/domain/AdvancedPlayerSqlObject.java
// @RegisterRowMapper(AdvancedPlayerSqlObject.PlayerMapper.class)
// @UseStringTemplateSqlLocator
// public interface AdvancedPlayerSqlObject {
// 
//     @SqlQuery
//     List<Player> getPlayers(@Define("isFirstName") boolean isFirstName, @Bind("firstName") String firstName,
//                             @Define("isFirstName") boolean isLastName, @Bind("lastName") String lastName,
//                             @Define("isSort") boolean isSort, @Define("sortBy") String sortBy,
//                             @Define("isSortDesc") boolean isSortDesc,
//                             @Define("isLimit") boolean isLimit, @Define("limit") int limit,
//                             @Define("isOffset") boolean isOffset, @Define("offset") int offset);
// 
//     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/SqlLocatorTest.java
import com.github.arteam.jdit.annotations.DataSet;
import com.github.arteam.jdit.annotations.JditProperties;
import com.github.arteam.jdit.annotations.TestedSqlObject;
import com.github.arteam.jdit.domain.AdvancedPlayerSqlObject;
import com.github.arteam.jdit.domain.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;

package com.github.arteam.jdit;




@RunWith(DBIRunner.class)
@JditProperties("jdit-h2.properties")
public class SqlLocatorTest {

    @TestedSqlObject
    AdvancedPlayerSqlObject playerDao;

    @Test
    @DataSet("playerDao/players.sql")
    public void getPlayerBySeveralAtributes() {
        List<Player> players = playerDao.getPlayers(true, "John", true, "Tavares", true, "last_name", true,
                true, 3, true, 0);
        assertThat(players).hasSize(1);
        assertThat(players).extracting(p -> p.firstName).containsOnly("John");