use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestBatching method testBooleanReturn.
@Test
public void testBooleanReturn() throws Exception {
BooleanBatchDao dao = handle.attach(BooleanBatchDao.class);
assertThat(dao.insert(new Something(1, "foo"), new Something(2, "bar"))).containsExactly(true, true);
assertThat(dao.update(new Something(1, "baz"), new Something(3, "buz"))).containsExactly(true, false);
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestBeanBinder method testInsert.
@Test
public void testInsert() throws Exception {
Spiffy s = handle.attach(Spiffy.class);
s.insert(new Something(2, "Bean"));
String name = handle.createQuery("select name from something where id = 2").mapTo(String.class).findOnly();
assertThat(name).isEqualTo("Bean");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestBeanBinder method testRead.
@Test
public void testRead() throws Exception {
Spiffy s = handle.attach(Spiffy.class);
handle.execute("insert into something (id, name) values (17, 'Phil')");
Something phil = s.findByEqualsOnBothFields(new Something(17, "Phil"));
assertThat(phil.getName()).isEqualTo("Phil");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestBindAutomaticNames method testNoAnnotation.
@Test
public void testNoAnnotation() throws Exception {
Spiffy spiffy = dbRule.getSharedHandle().attach(Spiffy.class);
Something s = spiffy.findByIdNoAnnotation(7);
assertThat(s.getName()).isEqualTo("Tim");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestBindBean method testBindBean.
@Test
public void testBindBean() {
handle.execute("insert into something (id, name) values (1, 'Alice')");
assertThat(dao.getName(1)).isEqualTo("Alice");
dao.update(new Something(1, "Alicia"));
assertThat(dao.getName(1)).isEqualTo("Alicia");
}
Aggregations