private void openSession(String aConfig) throws Exception {
    final String resource = "org/apache/ibatis/submitted/automatic_lazy_loading/ibatis-automatic-lazy-load-" + aConfig + ".xml";
    Reader batisConfigReader = Resources.getResourceAsReader(resource);

    SqlSessionFactory sqlSessionFactory;
    try {
      sqlSessionFactory = new SqlSessionFactoryBuilder().build(batisConfigReader);
    } catch(Exception anException) {
      throw new RuntimeException("Mapper configuration failed, expected this to work: " + anException.getMessage(), anException);
    }

    SqlSession session = sqlSessionFactory.openSession();

    Connection conn = session.getConnection();
    ScriptRunner runner = new ScriptRunner(conn);
    runner.setLogWriter(null);
    runner.setErrorLogWriter(null);
    Reader createScriptReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/automatic_lazy_loading/create.sql");
    runner.runScript(createScriptReader);

    sqlSession = sqlSessionFactory.openSession();
  }
Create a session with the specified configuration and initialized the database.
src/test/java/org/apache/ibatis/submitted/automatic_lazy_loading/AutomaticLazyLoadingTest.java