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