Author: jgbutler Date: Tue Jan 5 23:27:10 2010 New Revision: 896270 URL: http://svn.apache.org/viewvc?rev=896270&view=rev Log: Clean up a few tests
Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/parsing/XPathParserTest.java ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/substitution_in_annots/SubstitutionInAnnotsTest.java Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/parsing/XPathParserTest.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/parsing/XPathParserTest.java?rev=896270&r1=896269&r2=896270&view=diff ============================================================================== --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/parsing/XPathParserTest.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/parsing/XPathParserTest.java Tue Jan 5 23:27:10 2010 @@ -13,7 +13,7 @@ String resource = "resources/nodelet_test.xml"; Reader reader = Resources.getResourceAsReader(resource); XPathParser parser = new XPathParser(reader, false, null, null); - assertEquals(5.8d, parser.evalDouble("/employee/height")); + assertEquals((Double) 5.8d, parser.evalDouble("/employee/height")); assertEquals("${id_var}", parser.evalString("/employee/@id")); assertEquals(Boolean.TRUE, parser.evalBoolean("/employee/active")); assertEquals("<id>${id_var}</id>", parser.evalNode("/employee/@id").toString().trim()); Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java?rev=896270&r1=896269&r2=896270&view=diff ============================================================================== --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/session/SqlSessionTest.java Tue Jan 5 23:27:10 2010 @@ -42,7 +42,7 @@ SqlSession session = sqlMapper.openSession(); try { Integer count = (Integer) session.selectOne("domain.blog.mappers.BlogMapper.selectCountOfPosts"); - assertEquals(5, count); + assertEquals(5, count.intValue()); } finally { session.close(); } Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java?rev=896270&r1=896269&r2=896270&view=diff ============================================================================== --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java Tue Jan 5 23:27:10 2010 @@ -112,10 +112,10 @@ selected2 = personMapper.selectById(2); selected3 = personMapper.selectById(3); Person selected4 = personMapper.selectById(4); - Assert.assertEquals(1,selected1.getId()); - Assert.assertEquals(2,selected2.getId()); - Assert.assertEquals(3,selected3.getId()); - Assert.assertEquals(4,selected4.getId()); + Assert.assertEquals(1,selected1.getId().longValue()); + Assert.assertEquals(2,selected2.getId().longValue()); + Assert.assertEquals(3,selected3.getId().longValue()); + Assert.assertEquals(4,selected4.getId().longValue()); } finally { sqlSession.close(); @@ -128,7 +128,7 @@ try { PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class); Person selected1 = personMapper.selectByStringId("1"); - Assert.assertEquals(1,selected1.getId()); + Assert.assertEquals(1,selected1.getId().longValue()); } finally { sqlSession.close(); Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/substitution_in_annots/SubstitutionInAnnotsTest.java URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/substitution_in_annots/SubstitutionInAnnotsTest.java?rev=896270&r1=896269&r2=896270&view=diff ============================================================================== --- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/substitution_in_annots/SubstitutionInAnnotsTest.java (original) +++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/test/java/org/apache/ibatis/submitted/substitution_in_annots/SubstitutionInAnnotsTest.java Tue Jan 5 23:27:10 2010 @@ -1,5 +1,12 @@ package org.apache.ibatis.submitted.substitution_in_annots; +import static org.junit.Assert.assertEquals; + +import java.io.PrintWriter; +import java.io.Reader; +import java.sql.Connection; +import java.sql.DriverManager; + import org.apache.ibatis.datasource.unpooled.UnpooledDataSource; import org.apache.ibatis.io.Resources; import org.apache.ibatis.jdbc.ScriptRunner; @@ -9,22 +16,9 @@ import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.hsqldb.jdbcDriver; import org.junit.BeforeClass; import org.junit.Test; -import java.io.PrintWriter; -import java.io.Reader; -import java.sql.Connection; -import java.sql.DriverManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - public class SubstitutionInAnnotsTest { @@ -32,7 +26,7 @@ @BeforeClass public static void setUp() throws Exception { - DriverManager.registerDriver(new jdbcDriver()); + Class.forName("org.hsqldb.jdbcDriver"); Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:annots", "sa", ""); Reader reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/substitution_in_annots/CreateDB.sql"); ScriptRunner runner = new ScriptRunner(c); @@ -43,7 +37,7 @@ reader.close(); Configuration configuration = new Configuration(); - Environment environment = new Environment("test", new JdbcTransactionFactory(), new UnpooledDataSource(jdbcDriver.class.getName(), "jdbc:hsqldb:mem:annots", null)); + Environment environment = new Environment("test", new JdbcTransactionFactory(), new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:annots", null)); configuration.setEnvironment(environment); configuration.addMapper(SubstitutionInAnnotsMapper.class);