use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestConditionalStringTemplateLocator method setUp.
@Before
public void setUp() throws Exception {
Handle handle = dbRule.getSharedHandle();
handle.execute("insert into something (id, name) values (1, 'Martin')");
handle.execute("insert into something (id, name) values (3, 'David')");
handle.execute("insert into something (id, name) values (2, 'Joe')");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestStringTemplateSqlLocator method testBam.
@Test
public void testBam() throws Exception {
handle.execute("insert into something (id, name) values (6, 'Martin')");
Something s = handle.attach(Wombat.class).findById(6L);
assertThat(s.getName()).isEqualTo("Martin");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestStringTemplateSqlLocator method testBaz.
@Test
public void testBaz() throws Exception {
Wombat wombat = handle.attach(Wombat.class);
wombat.insert(new Something(7, "Henning"));
String name = handle.createQuery("select name from something where id = 7").mapTo(String.class).findOnly();
assertThat(name).isEqualTo("Henning");
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestStringTemplateSqlLocator method testBatching.
@Test
public void testBatching() throws Exception {
Wombat roo = handle.attach(Wombat.class);
roo.insertBunches(new Something(1, "Jeff"), new Something(2, "Brian"));
assertThat(roo.findById(1L)).isEqualTo(new Something(1, "Jeff"));
assertThat(roo.findById(2L)).isEqualTo(new Something(2, "Brian"));
}
use of org.jdbi.v3.core.Something in project jdbi by jdbi.
the class TestVavrValueArgumentFactoryWithDB method testGetValidationValid_shouldReturnCorrectRow.
@Test
public void testGetValidationValid_shouldReturnCorrectRow() {
Something result = dbRule.getSharedHandle().createQuery(SELECT_BY_NAME).bind("name", Validation.valid("brian")).mapToBean(Something.class).findOnly();
assertThat(result).isEqualTo(BRIAN_SOMETHING);
}
Aggregations