Search in sources :

Example 16 with SomethingMapper

use of org.jdbi.v3.core.mapper.SomethingMapper in project jdbi by jdbi.

the class BindListNullTest method init.

@BeforeClass
public static void init() {
    final Jdbi db = dbRule.getJdbi();
    db.registerRowMapper(new SomethingMapper());
    db.installPlugin(new SqlObjectPlugin());
    handle = db.open();
    handle.execute("insert into something(id, name) values(1, null)");
    handle.execute("insert into something(id, name) values(2, null)");
    handle.execute("insert into something(id, name) values(3, null)");
    handle.execute("insert into something(id, name) values(4, null)");
    handle.execute("insert into something(id, name) values(5, 'bla')");
    handle.execute("insert into something(id, name) values(6, 'null')");
    handle.execute("insert into something(id, name) values(7, '')");
}
Also used : SomethingMapper(org.jdbi.v3.core.mapper.SomethingMapper) Jdbi(org.jdbi.v3.core.Jdbi) BeforeClass(org.junit.BeforeClass)

Example 17 with SomethingMapper

use of org.jdbi.v3.core.mapper.SomethingMapper in project jdbi by jdbi.

the class BindListTest method init.

@BeforeClass
public static void init() {
    final Jdbi db = dbRule.getJdbi();
    db.installPlugin(new SqlObjectPlugin());
    db.registerRowMapper(new SomethingMapper());
    handle = db.open();
    handle.execute("insert into something(id, name) values(1, '1')");
    handle.execute("insert into something(id, name) values(2, '2')");
    // "control group" element that should *not* be returned by the queries
    handle.execute("insert into something(id, name) values(3, '3')");
    expectedSomethings = Arrays.asList(new Something(1, "1"), new Something(2, "2"));
}
Also used : SomethingMapper(org.jdbi.v3.core.mapper.SomethingMapper) Jdbi(org.jdbi.v3.core.Jdbi) Something(org.jdbi.v3.core.Something) BeforeClass(org.junit.BeforeClass)

Aggregations

SomethingMapper (org.jdbi.v3.core.mapper.SomethingMapper)16 Something (org.jdbi.v3.core.Something)8 Test (org.junit.Test)8 Handle (org.jdbi.v3.core.Handle)7 Before (org.junit.Before)6 GenericType (org.jdbi.v3.core.generic.GenericType)4 JdbcDataSource (org.h2.jdbcx.JdbcDataSource)3 Jdbi (org.jdbi.v3.core.Jdbi)3 NoSuchMapperException (org.jdbi.v3.core.mapper.NoSuchMapperException)3 BeforeClass (org.junit.BeforeClass)3 Tuple2 (io.vavr.Tuple2)1 Tuple3 (io.vavr.Tuple3)1 Connection (java.sql.Connection)1