@Test
  public void testUsefulExceptionForBackTracing() throws Exception {
    Handle h = openHandle();

    try {
      h.createStatement("insert-id-name").bind("id", 1).execute();
      fail("should have raised an exception");
    } catch (StatementException e) {
      assertTrue(e.getMessage().contains("insert into something(id, name) values (:id, :name)"));
      assertTrue(e.getMessage().contains("insert into something(id, name) values (?, ?)"));
      assertTrue(e.getMessage().contains("insert-id-name"));
    }
  }
Exemple #2
0
 public void testUsefulArgumentOutputForDebug() throws Exception {
   try {
     h.createStatement("insert into something (id, name) values (:id, :name)")
         .bind("name", "brian")
         .bind(7, 8)
         .bindFromMap(new HandyMapThing<String>().add("one", "two"))
         .bindFromProperties(new Object())
         .execute();
   } catch (StatementException e) {
     assertTrue(
         e.getMessage()
             .contains(
                 "arguments:{ positional:{7:8}, named:{name:'brian'}, finder:[{one=two},{lazy bean proprty arguments \"java.lang.Object"));
   }
 }