Here is sample code for the @beforeTest method:
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new ( SqlSessionFactoryBuilder().build(inputStream);
SqlSession session = sqlSessionFactory.openSession();
here couldnot open the connection
and the output testing under testNG is:
FAILED CONFIGURATION: @BeforeTest setupPermission
org.apache.ibatis.exceptions.PersistenceException:
Error opening session. Cause: java.lang.NullPointerException
Cause: java.lang.NullPointerException
------------------------------------------------------
I want to use Connection, but not sure what kind of Connection myBatis is using in the code below:
SqlSession session = sqlSessionFactory.openSession(Connection con);