提交 b20f3175 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use assertFalse(value) instead of assertTrue(!value)

上级 4da501a8
......@@ -130,7 +130,7 @@ public class TestReadOnly extends TestBase {
File f = File.createTempFile("test", "temp");
assertTrue(f.canWrite());
f.setReadOnly();
assertTrue(!f.canWrite());
assertFalse(f.canWrite());
f.delete();
f = File.createTempFile("test", "temp");
......@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase {
r.write(1);
f.setReadOnly();
r.close();
assertTrue(!f.canWrite());
assertFalse(f.canWrite());
f.delete();
deleteDb("readonlyFiles");
......@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase {
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)");
stat.execute("INSERT INTO TEST VALUES(1, 'Hello')");
stat.execute("INSERT INTO TEST VALUES(2, 'World')");
assertTrue(!conn.isReadOnly());
assertFalse(conn.isReadOnly());
conn.close();
if (setReadOnly) {
......
......@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p);
conn.close();
assertTrue(!calledCreateIndex);
assertFalse(calledCreateIndex);
}
private void testIndexNotRebuilt() throws SQLException {
......@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p);
conn.close();
assertTrue(!calledCreateIndex);
assertFalse(calledCreateIndex);
}
private void testCloseLog0(boolean shutdown) throws SQLException {
......@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase {
conn = org.h2.Driver.load().connect(url, p);
conn.close();
if (calledOpened) {
assertTrue(!calledScan);
assertFalse(calledScan);
}
}
......
......@@ -1539,7 +1539,7 @@ public class TestPreparedStatement extends TestBase {
assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0);
}
}
assertTrue(!rs.next());
assertFalse(rs.next());
}
private void testColumnMetaDataWithEquals(Connection conn)
......
......@@ -632,7 +632,7 @@ public class TestResultSet extends TestBase {
assertTrue("TEST".equals(meta.getTableName(1)));
assertTrue("ID".equals(meta.getColumnName(1)));
assertTrue("VALUE".equals(meta.getColumnName(2)));
assertTrue(!meta.isAutoIncrement(1));
assertFalse(meta.isAutoIncrement(1));
assertTrue(meta.isCaseSensitive(1));
assertTrue(meta.isSearchable(1));
assertFalse(meta.isCurrency(1));
......@@ -709,7 +709,7 @@ public class TestResultSet extends TestBase {
rs.next();
assertTrue(rs.getRow() == 2);
assertTrue(rs.getInt(2) == 0 && !rs.wasNull());
assertTrue(!rs.getBoolean(2));
assertFalse(rs.getBoolean(2));
assertTrue(rs.getByte(2) == 0);
assertTrue(rs.getShort(2) == 0);
assertTrue(rs.getLong(2) == 0);
......@@ -829,7 +829,7 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getRow() == 2);
assertTrue(rs.getShort(2) == 0 && !rs.wasNull());
assertTrue(!rs.getBoolean(2));
assertFalse(rs.getBoolean(2));
assertTrue(rs.getByte(2) == 0);
assertTrue(rs.getInt(2) == 0);
assertTrue(rs.getLong(2) == 0);
......@@ -960,7 +960,7 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getRow() == 2);
assertTrue(rs.getLong(2) == 0 && !rs.wasNull());
assertTrue(!rs.getBoolean(2));
assertFalse(rs.getBoolean(2));
assertTrue(rs.getByte(2) == 0);
assertTrue(rs.getShort(2) == 0);
assertTrue(rs.getInt(2) == 0);
......@@ -1091,7 +1091,7 @@ public class TestResultSet extends TestBase {
trace("Value: <" + value + "> (should be: <\\%>)");
assertTrue(rs.getInt(1) == 11 && !rs.wasNull());
assertTrue(rs.getString(2).equals("\\%") && !rs.wasNull());
assertTrue(!rs.next());
assertFalse(rs.next());
stat.execute("DROP TABLE TEST");
}
......@@ -1122,12 +1122,12 @@ public class TestResultSet extends TestBase {
rs.next();
assertTrue(rs.getInt(1) == 1);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(rs.getInt(2) == -1);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
bd = rs.getBigDecimal(2);
assertTrue(bd.compareTo(new BigDecimal("-1.00")) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
o = rs.getObject(2);
trace(o.getClass().getName());
assertTrue(o instanceof BigDecimal);
......@@ -1139,12 +1139,12 @@ public class TestResultSet extends TestBase {
rs.next();
assertTrue(rs.getInt(1) == 2);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(rs.getInt(2) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
bd = rs.getBigDecimal(2);
assertTrue(bd.compareTo(new BigDecimal("0.00")) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
checkColumnBigDecimal(rs, 2, 1, "1.00");
......@@ -1161,7 +1161,7 @@ public class TestResultSet extends TestBase {
rs.next();
checkColumnBigDecimal(rs, 2, 0, null);
assertTrue(!rs.next());
assertFalse(rs.next());
stat.execute("DROP TABLE TEST");
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE DECIMAL(22,2))");
......@@ -1197,13 +1197,13 @@ public class TestResultSet extends TestBase {
BigDecimal bd;
rs.next();
assertTrue(rs.getInt(1) == 1);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(rs.getInt(2) == -1);
assertTrue(rs.getInt(3) == -1);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
bd = rs.getBigDecimal(2);
assertTrue(bd.compareTo(new BigDecimal("-1.00")) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
o = rs.getObject(2);
trace(o.getClass().getName());
assertTrue(o instanceof Double);
......@@ -1222,17 +1222,17 @@ public class TestResultSet extends TestBase {
assertTrue(((Float) o).compareTo(-1f) == 0);
rs.next();
assertTrue(rs.getInt(1) == 2);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(rs.getInt(2) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(rs.getInt(3) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
bd = rs.getBigDecimal(2);
assertTrue(bd.compareTo(new BigDecimal("0.00")) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
bd = rs.getBigDecimal(3);
assertTrue(bd.compareTo(new BigDecimal("0.00")) == 0);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
assertEquals(1.0, rs.getDouble(2));
assertEquals(1.0f, rs.getFloat(3));
......@@ -1248,7 +1248,7 @@ public class TestResultSet extends TestBase {
rs.next();
checkColumnBigDecimal(rs, 2, 0, null);
checkColumnBigDecimal(rs, 3, 0, null);
assertTrue(!rs.next());
assertFalse(rs.next());
stat.execute("DROP TABLE TEST");
}
......@@ -1290,11 +1290,11 @@ public class TestResultSet extends TestBase {
java.sql.Time time;
java.sql.Timestamp ts;
date = rs.getDate(2);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
time = rs.getTime(2);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
ts = rs.getTimestamp(2);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace("Date: " + date.toString() + " Time:" + time.toString() +
" Timestamp:" + ts.toString());
trace("Date ms: " + date.getTime() + " Time ms:" + time.getTime() +
......@@ -1337,11 +1337,11 @@ public class TestResultSet extends TestBase {
rs.next();
date = rs.getDate("VALUE");
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
time = rs.getTime("VALUE");
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
ts = rs.getTimestamp("VALUE");
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace("Date: " + date.toString() +
" Time:" + time.toString() + " Timestamp:" + ts.toString());
assertEquals("2002-02-02", date.toString());
......@@ -1390,7 +1390,7 @@ public class TestResultSet extends TestBase {
assertTrue(rs.getObject(2,
LocalDateTimeUtils.LOCAL_DATE_TIME) == null && rs.wasNull());
}
assertTrue(!rs.next());
assertFalse(rs.next());
rs = stat.executeQuery("SELECT DATE '2001-02-03' D, " +
"TIME '14:15:16', " +
......@@ -1565,31 +1565,31 @@ public class TestResultSet extends TestBase {
assertEqualsWithNull(new byte[] { (byte) 0x01, (byte) 0x01,
(byte) 0x01, (byte) 0x01 },
rs.getBytes(2));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertEqualsWithNull(new byte[] { (byte) 0x01, (byte) 0x01,
(byte) 0x01, (byte) 0x01 },
rs.getObject(2, byte[].class));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
assertEqualsWithNull(new byte[] { (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x02 },
rs.getBytes("value"));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertEqualsWithNull(new byte[] { (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x02 },
rs.getObject("value", byte[].class));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
assertEqualsWithNull(new byte[] { (byte) 0x00 },
readAllBytes(rs.getBinaryStream(2)));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
assertEqualsWithNull(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff },
readAllBytes(rs.getBinaryStream("VaLuE")));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
InputStream in = rs.getBinaryStream("value");
......@@ -1602,11 +1602,11 @@ public class TestResultSet extends TestBase {
readAllBytes(blob.getBinaryStream()));
assertEqualsWithNull(new byte[] { (byte) 0xce,
(byte) 0xc1 }, readAllBytes(blob.getBinaryStream(2, 2)));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
} finally {
blob.free();
}
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
blob = rs.getObject("value", Blob.class);
......@@ -1616,7 +1616,7 @@ public class TestResultSet extends TestBase {
(byte) 0x03, (byte) 0x03 }, readAllBytes(blob.getBinaryStream()));
assertEqualsWithNull(new byte[] { (byte) 0x03,
(byte) 0x03 }, readAllBytes(blob.getBinaryStream(2, 2)));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertThrows(ErrorCode.INVALID_VALUE_2, blob).getBinaryStream(5, 1);
} finally {
blob.free();
......@@ -1634,14 +1634,14 @@ public class TestResultSet extends TestBase {
byte[] expected = Arrays.copyOfRange(random, 100, 50102);
byte[] got = readAllBytes(blob.getBinaryStream(101, 50002));
assertEqualsWithNull(expected, got);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertThrows(ErrorCode.INVALID_VALUE_2, blob).getBinaryStream(0x10001, 1);
assertThrows(ErrorCode.INVALID_VALUE_2, blob).getBinaryStream(0x10002, 0);
} finally {
blob.free();
}
assertTrue(!rs.next());
assertFalse(rs.next());
stat.execute("DROP TABLE TEST");
}
......@@ -1669,7 +1669,7 @@ public class TestResultSet extends TestBase {
assertTrue(obj instanceof java.sql.Clob);
string = rs.getString(2);
assertTrue(string != null && string.equals("Test"));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
rs.next();
InputStreamReader reader = null;
try {
......@@ -1678,7 +1678,7 @@ public class TestResultSet extends TestBase {
assertTrue(false);
}
string = readString(reader);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace(string);
assertTrue(string != null && string.equals("Hello"));
rs.next();
......@@ -1688,13 +1688,13 @@ public class TestResultSet extends TestBase {
assertTrue(false);
}
string = readString(reader);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace(string);
assertTrue(string != null && string.equals("World!"));
rs.next();
string = readString(rs.getCharacterStream(2));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace(string);
assertTrue(string != null && string.equals("Hallo"));
Clob clob = rs.getClob(2);
......@@ -1708,7 +1708,7 @@ public class TestResultSet extends TestBase {
rs.next();
string = readString(rs.getCharacterStream("value"));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
trace(string);
assertTrue(string != null && string.equals("Welt!"));
rs.next();
......@@ -1718,7 +1718,7 @@ public class TestResultSet extends TestBase {
assertTrue(clob != null);
string = readString(clob.getCharacterStream());
assertTrue(string != null && string.equals("Test2"));
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
} finally {
clob.free();
}
......@@ -1835,7 +1835,7 @@ public class TestResultSet extends TestBase {
assertTrue(rs.wasNull());
} else {
trace("BigDecimal i=" + i + " bd=" + bd + " ; i1=" + i1 + " bd1=" + bd1);
assertTrue(!rs.wasNull());
assertFalse(rs.wasNull());
assertTrue(i1 == i);
assertTrue(bd1.compareTo(new BigDecimal(bd)) == 0);
}
......
......@@ -204,7 +204,7 @@ public class TestStatement extends TestBase {
assertEquals(ResultSet.CONCUR_READ_ONLY,
stat2.getResultSetConcurrency());
assertEquals(0, stat.getMaxFieldSize());
assertTrue(!((JdbcStatement) stat2).isClosed());
assertFalse(((JdbcStatement) stat2).isClosed());
stat2.close();
assertTrue(((JdbcStatement) stat2).isClosed());
......@@ -279,19 +279,19 @@ public class TestStatement extends TestBase {
trace("execute");
result = stat.execute(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
assertTrue(!result);
assertFalse(result);
result = stat.execute("INSERT INTO TEST VALUES(1,'Hello')");
assertTrue(!result);
assertFalse(result);
result = stat.execute("INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)");
assertTrue(!result);
assertFalse(result);
result = stat.execute("UPDATE TEST SET VALUE='LDBC' WHERE ID=2");
assertTrue(!result);
assertFalse(result);
result = stat.execute("DELETE FROM TEST WHERE ID=3");
assertTrue(!result);
assertFalse(result);
result = stat.execute("SELECT * FROM TEST");
assertTrue(result);
result = stat.execute("DROP TABLE TEST");
assertTrue(!result);
assertFalse(result);
assertThrows(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY, stat).
executeQuery("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
......
......@@ -148,13 +148,13 @@ public class TestXA extends TestBase {
XAResource res = xa.getXAResource();
res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit());
assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMSUCCESS);
res.commit(xid, true);
assertTrue(c.getAutoCommit());
res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit());
assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMFAIL);
res.rollback(xid);
assertTrue(c.getAutoCommit());
......@@ -193,7 +193,7 @@ public class TestXA extends TestBase {
xa.getXAResource().start(xid,
XAResource.TMNOFLAGS);
Connection c = xa.getConnection();
assertTrue(!c.getAutoCommit());
assertFalse(c.getAutoCommit());
c.close();
xa.close();
}
......
......@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase {
for (String f : FileUtils.newDirectoryStream(
"zip:" + getBaseDir() + "/fsJar.zip")) {
assertFalse(FileUtils.isAbsolute(f));
assertTrue(!FileUtils.isDirectory(f));
assertFalse(FileUtils.isDirectory(f));
assertTrue(FileUtils.size(f) > 0);
assertTrue(f.endsWith(FileUtils.getName(f)));
assertEquals(0, FileUtils.lastModified(f));
......@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase {
IOUtils.copyFiles(fsBase + "/test", fsBase + "/test3");
FileUtils.move(fsBase + "/test3", fsBase + "/test2");
FileUtils.move(fsBase + "/test2", fsBase + "/test2");
assertTrue(!FileUtils.exists(fsBase + "/test3"));
assertFalse(FileUtils.exists(fsBase + "/test3"));
assertTrue(FileUtils.exists(fsBase + "/test2"));
assertEquals(10000, FileUtils.size(fsBase + "/test2"));
byte[] buffer2 = new byte[10000];
......@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase {
assertTrue(FileUtils.isDirectory(fsBase + "/testDir"));
if (!fsBase.startsWith("jdbc:")) {
FileUtils.deleteRecursive(fsBase + "/testDir", false);
assertTrue(!FileUtils.exists(fsBase + "/testDir"));
assertFalse(FileUtils.exists(fsBase + "/testDir"));
}
}
}
......
......@@ -760,7 +760,7 @@ public class TestTools extends TestBase {
assertEquals(Double.MIN_VALUE, rs.getDouble("b"));
assertEquals(Long.MIN_VALUE, rs.getLong("c"));
assertEquals(Short.MIN_VALUE, rs.getShort("d"));
assertTrue(!rs.getBoolean("e"));
assertFalse(rs.getBoolean("e"));
assertEquals(new byte[] { (byte) 10, (byte) 20 }, rs.getBytes("f"));
assertEquals("2007-12-31", rs.getString("g"));
assertEquals("23:59:59", rs.getString("h"));
......
......@@ -302,7 +302,7 @@ public class TestValue extends TestBase {
for (int i = 0; i < d.length - 1; i++) {
assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSafe(values[i], null) > 0);
assertTrue(!values[i].equals(values[i+1]));
assertFalse(values[i].equals(values[i+1]));
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论