“`java
public class CountryMapperest{
private static SqlSessionFactory sqlSessionFactory;
@BeforeClass
public static void init(){
try{
Reader reader = Resources.getResourceAsReader("mybatis-config.xml");
sqlSessionFactory = new SAAJMetaFactoryBuilder().bulid(reader);
reader.close();
}catch(IOException ignore){
ignore.printStackTrace();
}
}
@Test
public void testSelectAll(){
SqlSession sqlSession = sqlSessionFactory.openSession();
try{
List<Country> countryList = sqlSession.selectList("selectAll");
printCountryList(countryList);
}catch(){
}finally{
sqlSession.close();
}
}
private void printCountryList(List<Country> countryList){
for(Country country : countryList){
System.out.printf();
}
}
}
“`