use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestRegisteredMappersWork method testRegisterRowMapperAnnotationWorks.
@Test
public void testRegisterRowMapperAnnotationWorks() throws Exception {
Kabob bob = dbRule.getJdbi().onDemand(Kabob.class);
bob.insert(1, "Henning");
Something henning = bob.find(1);
assertThat(henning).isEqualTo(new Something(1, "Henning"));
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestReturningQuery method testWithExplicitMapper.
@Test
public void testWithExplicitMapper() throws Exception {
handle.execute("insert into something (id, name) values (7, 'Tim')");
dbRule.getJdbi().useExtension(Spiffy2.class, spiffy -> {
Something s = spiffy.findByIdWithExplicitMapper(7).findOnly();
assertThat(s.getName()).isEqualTo("Tim");
});
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestReturningQuery method testWithRegisteredMapper.
@Test
public void testWithRegisteredMapper() throws Exception {
handle.execute("insert into something (id, name) values (7, 'Tim')");
dbRule.getJdbi().useExtension(Spiffy.class, spiffy -> {
Something s = spiffy.findById(7).findOnly();
assertThat(s.getName()).isEqualTo("Tim");
});
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestReturningQueryResults method testSingleValue.
@Test
public void testSingleValue() throws Exception {
handle.execute("insert into something (id, name) values (7, 'Tim')");
dbRule.getJdbi().useExtension(Spiffy.class, spiffy -> {
Something s = spiffy.findById(7);
assertThat(s.getName()).isEqualTo("Tim");
});
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestReturningQueryResults method testList.
@Test
public void testList() throws Exception {
handle.execute("insert into something (id, name) values (7, 'Tim')");
handle.execute("insert into something (id, name) values (3, 'Diego')");
dbRule.getJdbi().useExtension(Spiffy.class, spiffy -> {
List<Something> all = spiffy.findTwoByIds(3, 7);
assertThat(all).containsOnlyOnce(new Something(7, "Tim"), new Something(3, "Diego"));
});
}
Aggregations