LocalDBSessionFactory implements DBSessionFactory { @Override public DBSession createSession() throws JasDBException { if(StringUtils.stringNotEmpty(instance)) { return new LocalDBSession(instance); } else { return new LocalDBSession(); } }  @Override DBSession createSession(); @Override DBSession createSession(Credentials credentials); @Override DBSession createSession(String instance); @Override DBSession createSession(String instance, Credentials credentials); void shutdown(); String getInstance(); void setInstance(String instance);  }
@Test public void testCreateWithInstancId() throws JasDBException, IOException { LocalDBSessionFactory localDBSessionFactory = new LocalDBSessionFactory(); localDBSessionFactory.createSession().addInstance("testInstance"); DBSession session = localDBSessionFactory.createSession("testInstance"); assertThat(session.getInstanceId(), is("testInstance")); }
@Test public void testCreateDefaultSession() throws JasDBException { LocalDBSessionFactory localDBSessionFactory = new LocalDBSessionFactory(); DBSession dbSession = localDBSessionFactory.createSession(); assertThat(dbSession.getInstanceId(), is("default")); }