@Test
  public void testDoubleDbOpen() throws Exception {
    clearDatabases();
    ConnectionSource cs =
        new JdbcConnectionSource(
            "jdbc:h2:file:" + DATABASE_DIR + "/" + DATABASE_NAME_PREFIX + ".1");
    TableUtils.createTable(cs, Foo.class);
    Dao<Foo, Integer> dao = Instances.getDaoManager().createDao(cs, Foo.class);
    Foo foo1 = new Foo();
    foo1.val = 12312;
    assertEquals(1, dao.create(foo1));

    Foo result = dao.queryForId(foo1.id);
    assertNotNull(result);
    assertEquals(foo1.val, result.val);

    // ==================================

    cs =
        new JdbcConnectionSource(
            "jdbc:h2:file:" + DATABASE_DIR + "/" + DATABASE_NAME_PREFIX + ".2");
    Instances.getDaoManager().clearCache();
    TableUtils.createTable(cs, Foo.class);
    dao = Instances.getDaoManager().createDao(cs, Foo.class);
    Foo foo2 = new Foo();
    foo2.val = 12314;
    assertEquals(1, dao.create(foo2));

    result = dao.queryForId(foo2.id);
    assertNotNull(result);
    assertEquals(foo2.val, result.val);
  }
 @Test(expected = IllegalArgumentException.class)
 public void testConfigureGeneratedIdNotInteger() throws Exception {
   Field field = Foo.class.getField("stringField");
   PropertyConfig propertyConfig =
       Instances.getFieldTypeCreator().createFieldType(connectionSource, "foo", field, Foo.class);
   OurSqliteDatabaseType dbType = new OurSqliteDatabaseType();
   StringBuilder sb = new StringBuilder();
   dbType.configureGeneratedId(
       null,
       sb,
       propertyConfig,
       new ArrayList<String>(),
       null,
       new ArrayList<String>(),
       new ArrayList<String>());
 }
 @Test
 public void testConfigureGeneratedIdInteger() throws Exception {
   Field field = Foo.class.getField("val");
   PropertyConfig propertyConfig =
       Instances.getFieldTypeCreator().createFieldType(connectionSource, "foo", field, Foo.class);
   OurSqliteDatabaseType dbType = new OurSqliteDatabaseType();
   StringBuilder sb = new StringBuilder();
   dbType.configureGeneratedId(
       null,
       sb,
       propertyConfig,
       new ArrayList<String>(),
       null,
       new ArrayList<String>(),
       new ArrayList<String>());
   assertTrue(sb.toString().contains("PRIMARY KEY AUTOINCREMENT"));
 }