提交 4fe88699 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use assertNull(value) instead of assertTrue(value == null)

上级 b20f3175
...@@ -85,7 +85,7 @@ public class TestBatchUpdates extends TestBase { ...@@ -85,7 +85,7 @@ public class TestBatchUpdates extends TestBase {
assertTrue(e != null); assertTrue(e != null);
assertContains(e.toString(), "TEST_X"); assertContains(e.toString(), "TEST_X");
e = e.getNextException(); e = e.getNextException();
assertTrue(e == null); assertNull(e);
} }
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
PreparedStatement prep = conn.prepareStatement("insert into test values(?)"); PreparedStatement prep = conn.prepareStatement("insert into test values(?)");
...@@ -104,7 +104,7 @@ public class TestBatchUpdates extends TestBase { ...@@ -104,7 +104,7 @@ public class TestBatchUpdates extends TestBase {
assertTrue(e != null); assertTrue(e != null);
assertContains(e.toString(), "TEST_X"); assertContains(e.toString(), "TEST_X");
e = e.getNextException(); e = e.getNextException();
assertTrue(e == null); assertNull(e);
} }
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
......
...@@ -367,7 +367,7 @@ public class TestMetaData extends TestBase { ...@@ -367,7 +367,7 @@ public class TestMetaData extends TestBase {
assertTrue(dr.jdbcCompliant()); assertTrue(dr.jdbcCompliant());
assertEquals(0, dr.getPropertyInfo(null, null).length); assertEquals(0, dr.getPropertyInfo(null, null).length);
assertTrue(dr.connect("jdbc:test:false", null) == null); assertNull(dr.connect("jdbc:test:false", null));
assertTrue(meta.getNumericFunctions().length() > 0); assertTrue(meta.getNumericFunctions().length() > 0);
assertTrue(meta.getStringFunctions().length() > 0); assertTrue(meta.getStringFunctions().length() > 0);
...@@ -994,9 +994,9 @@ public class TestMetaData extends TestBase { ...@@ -994,9 +994,9 @@ public class TestMetaData extends TestBase {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR }, null, null); Types.VARCHAR, Types.VARCHAR, Types.VARCHAR }, null, null);
assertTrue(conn.getWarnings() == null); assertNull(conn.getWarnings());
conn.clearWarnings(); conn.clearWarnings();
assertTrue(conn.getWarnings() == null); assertNull(conn.getWarnings());
conn.close(); conn.close();
} }
...@@ -1050,7 +1050,7 @@ public class TestMetaData extends TestBase { ...@@ -1050,7 +1050,7 @@ public class TestMetaData extends TestBase {
rs = meta.getTables(null, Constants.SCHEMA_MAIN, rs = meta.getTables(null, Constants.SCHEMA_MAIN,
null, new String[] { "TABLE" }); null, new String[] { "TABLE" });
assertTrue(rs.getStatement() == null); assertNull(rs.getStatement());
rs.next(); rs.next();
assertEquals("TEST", rs.getString("TABLE_NAME")); assertEquals("TEST", rs.getString("TABLE_NAME"));
assertFalse(rs.next()); assertFalse(rs.next());
......
...@@ -618,7 +618,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -618,7 +618,7 @@ public class TestPreparedStatement extends TestBase {
rs.next(); rs.next();
Object o = rs.getObject(2); Object o = rs.getObject(2);
assertTrue(o instanceof byte[]); assertTrue(o instanceof byte[]);
assertTrue(rs.getObject(3) == null); assertNull(rs.getObject(3));
rs.next(); rs.next();
o = rs.getObject(2); o = rs.getObject(2);
assertTrue(o instanceof byte[]); assertTrue(o instanceof byte[]);
...@@ -1446,9 +1446,9 @@ public class TestPreparedStatement extends TestBase { ...@@ -1446,9 +1446,9 @@ public class TestPreparedStatement extends TestBase {
assertEquals(ascii2, rs.getString(3)); assertEquals(ascii2, rs.getString(3));
assertFalse(rs.next()); assertFalse(rs.next());
assertTrue(prep.getWarnings() == null); assertNull(prep.getWarnings());
prep.clearWarnings(); prep.clearWarnings();
assertTrue(prep.getWarnings() == null); assertNull(prep.getWarnings());
assertTrue(conn == prep.getConnection()); assertTrue(conn == prep.getConnection());
} }
...@@ -1534,7 +1534,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -1534,7 +1534,7 @@ public class TestPreparedStatement extends TestBase {
java.math.BigDecimal x = rs.getBigDecimal(1); java.math.BigDecimal x = rs.getBigDecimal(1);
trace("v=" + v + " x=" + x); trace("v=" + v + " x=" + x);
if (v == null) { if (v == null) {
assertTrue(x == null); assertNull(x);
} else { } else {
assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0); assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0);
} }
......
...@@ -739,10 +739,10 @@ public class TestResultSet extends TestBase { ...@@ -739,10 +739,10 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getString(1).equals("6") && !rs.wasNull()); assertTrue(rs.getString(1).equals("6") && !rs.wasNull());
assertTrue(rs.getString(2) == null && rs.wasNull()); assertTrue(rs.getString(2) == null && rs.wasNull());
o = rs.getObject(2); o = rs.getObject(2);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
o = rs.getObject(2, Integer.class); o = rs.getObject(2, Integer.class);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
assertFalse(rs.next()); assertFalse(rs.next());
assertEquals(0, rs.getRow()); assertEquals(0, rs.getRow());
...@@ -863,10 +863,10 @@ public class TestResultSet extends TestBase { ...@@ -863,10 +863,10 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getString(1).equals("6") && !rs.wasNull()); assertTrue(rs.getString(1).equals("6") && !rs.wasNull());
assertTrue(rs.getString(2) == null && rs.wasNull()); assertTrue(rs.getString(2) == null && rs.wasNull());
o = rs.getObject(2); o = rs.getObject(2);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
o = rs.getObject(2, Short.class); o = rs.getObject(2, Short.class);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
assertFalse(rs.next()); assertFalse(rs.next());
assertEquals(0, rs.getRow()); assertEquals(0, rs.getRow());
...@@ -994,10 +994,10 @@ public class TestResultSet extends TestBase { ...@@ -994,10 +994,10 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getString(1).equals("6") && !rs.wasNull()); assertTrue(rs.getString(1).equals("6") && !rs.wasNull());
assertTrue(rs.getString(2) == null && rs.wasNull()); assertTrue(rs.getString(2) == null && rs.wasNull());
o = rs.getObject(2); o = rs.getObject(2);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
o = rs.getObject(2, Long.class); o = rs.getObject(2, Long.class);
assertTrue(o == null); assertNull(o);
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
assertFalse(rs.next()); assertFalse(rs.next());
assertEquals(0, rs.getRow()); assertEquals(0, rs.getRow());
...@@ -1724,17 +1724,17 @@ public class TestResultSet extends TestBase { ...@@ -1724,17 +1724,17 @@ public class TestResultSet extends TestBase {
} }
rs.next(); rs.next();
assertTrue(rs.getCharacterStream(2) == null); assertNull(rs.getCharacterStream(2));
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
rs.next(); rs.next();
assertTrue(rs.getAsciiStream("Value") == null); assertNull(rs.getAsciiStream("Value"));
assertTrue(rs.wasNull()); assertTrue(rs.wasNull());
assertTrue(rs.getStatement() == stat); assertTrue(rs.getStatement() == stat);
assertTrue(rs.getWarnings() == null); assertNull(rs.getWarnings());
rs.clearWarnings(); rs.clearWarnings();
assertTrue(rs.getWarnings() == null); assertNull(rs.getWarnings());
assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection());
assertEquals(ResultSet.CONCUR_UPDATABLE, rs.getConcurrency()); assertEquals(ResultSet.CONCUR_UPDATABLE, rs.getConcurrency());
rs.next(); rs.next();
......
...@@ -324,9 +324,9 @@ public class TestStatement extends TestBase { ...@@ -324,9 +324,9 @@ public class TestStatement extends TestBase {
stat.execute("DROP TABLE TEST"); stat.execute("DROP TABLE TEST");
stat.executeUpdate("DROP TABLE IF EXISTS TEST"); stat.executeUpdate("DROP TABLE IF EXISTS TEST");
assertTrue(stat.getWarnings() == null); assertNull(stat.getWarnings());
stat.clearWarnings(); stat.clearWarnings();
assertTrue(stat.getWarnings() == null); assertNull(stat.getWarnings());
assertTrue(conn == stat.getConnection()); assertTrue(conn == stat.getConnection());
assertEquals("SOME_ID", statBC.enquoteIdentifier("SOME_ID", false)); assertEquals("SOME_ID", statBC.enquoteIdentifier("SOME_ID", false));
......
...@@ -50,7 +50,7 @@ public class TestClassLoaderLeak extends TestBase { ...@@ -50,7 +50,7 @@ public class TestClassLoaderLeak extends TestBase {
Thread.sleep(10); Thread.sleep(10);
} }
ClassLoader cl = ref.get(); ClassLoader cl = ref.get();
assertTrue(cl == null); assertNull(cl);
// fill the memory, so a heap dump is created // fill the memory, so a heap dump is created
// using -XX:+HeapDumpOnOutOfMemoryError // using -XX:+HeapDumpOnOutOfMemoryError
// which can be analyzed using EclipseMAT // which can be analyzed using EclipseMAT
......
...@@ -476,7 +476,7 @@ public class TestTools extends TestBase { ...@@ -476,7 +476,7 @@ public class TestTools extends TestBase {
assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection());
assertEquals(0, rs.getFetchSize()); assertEquals(0, rs.getFetchSize());
assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType()); assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
assertTrue(rs.getStatement() == null); assertNull(rs.getStatement());
assertFalse(rs.isClosed()); assertFalse(rs.isClosed());
rs.beforeFirst(); rs.beforeFirst();
...@@ -902,8 +902,8 @@ public class TestTools extends TestBase { ...@@ -902,8 +902,8 @@ public class TestTools extends TestBase {
"SELECT * FROM TEST ORDER BY ID"); "SELECT * FROM TEST ORDER BY ID");
rs.next(); rs.next();
assertEquals(1, rs.getInt(1)); assertEquals(1, rs.getInt(1));
assertTrue(rs.getString(2) == null); assertNull(rs.getString(2));
assertTrue(rs.getString(3) == null); assertNull(rs.getString(3));
rs.next(); rs.next();
assertEquals(2, rs.getInt(1)); assertEquals(2, rs.getInt(1));
assertEquals("face", rs.getString(2)); assertEquals("face", rs.getString(2));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论