提交 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 { ...@@ -130,7 +130,7 @@ public class TestReadOnly extends TestBase {
File f = File.createTempFile("test", "temp"); File f = File.createTempFile("test", "temp");
assertTrue(f.canWrite()); assertTrue(f.canWrite());
f.setReadOnly(); f.setReadOnly();
assertTrue(!f.canWrite()); assertFalse(f.canWrite());
f.delete(); f.delete();
f = File.createTempFile("test", "temp"); f = File.createTempFile("test", "temp");
...@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase { ...@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase {
r.write(1); r.write(1);
f.setReadOnly(); f.setReadOnly();
r.close(); r.close();
assertTrue(!f.canWrite()); assertFalse(f.canWrite());
f.delete(); f.delete();
deleteDb("readonlyFiles"); deleteDb("readonlyFiles");
...@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase { ...@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase {
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"); 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(1, 'Hello')");
stat.execute("INSERT INTO TEST VALUES(2, 'World')"); stat.execute("INSERT INTO TEST VALUES(2, 'World')");
assertTrue(!conn.isReadOnly()); assertFalse(conn.isReadOnly());
conn.close(); conn.close();
if (setReadOnly) { if (setReadOnly) {
......
...@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName()); MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
assertTrue(!calledCreateIndex); assertFalse(calledCreateIndex);
} }
private void testIndexNotRebuilt() throws SQLException { private void testIndexNotRebuilt() throws SQLException {
...@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName()); MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
assertTrue(!calledCreateIndex); assertFalse(calledCreateIndex);
} }
private void testCloseLog0(boolean shutdown) throws SQLException { private void testCloseLog0(boolean shutdown) throws SQLException {
...@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase {
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
if (calledOpened) { if (calledOpened) {
assertTrue(!calledScan); assertFalse(calledScan);
} }
} }
......
...@@ -1539,7 +1539,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -1539,7 +1539,7 @@ public class TestPreparedStatement extends TestBase {
assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0); assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0);
} }
} }
assertTrue(!rs.next()); assertFalse(rs.next());
} }
private void testColumnMetaDataWithEquals(Connection conn) private void testColumnMetaDataWithEquals(Connection conn)
......
...@@ -204,7 +204,7 @@ public class TestStatement extends TestBase { ...@@ -204,7 +204,7 @@ public class TestStatement extends TestBase {
assertEquals(ResultSet.CONCUR_READ_ONLY, assertEquals(ResultSet.CONCUR_READ_ONLY,
stat2.getResultSetConcurrency()); stat2.getResultSetConcurrency());
assertEquals(0, stat.getMaxFieldSize()); assertEquals(0, stat.getMaxFieldSize());
assertTrue(!((JdbcStatement) stat2).isClosed()); assertFalse(((JdbcStatement) stat2).isClosed());
stat2.close(); stat2.close();
assertTrue(((JdbcStatement) stat2).isClosed()); assertTrue(((JdbcStatement) stat2).isClosed());
...@@ -279,19 +279,19 @@ public class TestStatement extends TestBase { ...@@ -279,19 +279,19 @@ public class TestStatement extends TestBase {
trace("execute"); trace("execute");
result = stat.execute( result = stat.execute(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"); "CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
assertTrue(!result); assertFalse(result);
result = stat.execute("INSERT INTO TEST VALUES(1,'Hello')"); result = stat.execute("INSERT INTO TEST VALUES(1,'Hello')");
assertTrue(!result); assertFalse(result);
result = stat.execute("INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)"); 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"); result = stat.execute("UPDATE TEST SET VALUE='LDBC' WHERE ID=2");
assertTrue(!result); assertFalse(result);
result = stat.execute("DELETE FROM TEST WHERE ID=3"); result = stat.execute("DELETE FROM TEST WHERE ID=3");
assertTrue(!result); assertFalse(result);
result = stat.execute("SELECT * FROM TEST"); result = stat.execute("SELECT * FROM TEST");
assertTrue(result); assertTrue(result);
result = stat.execute("DROP TABLE TEST"); result = stat.execute("DROP TABLE TEST");
assertTrue(!result); assertFalse(result);
assertThrows(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY, stat). assertThrows(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY, stat).
executeQuery("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"); executeQuery("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
......
...@@ -148,13 +148,13 @@ public class TestXA extends TestBase { ...@@ -148,13 +148,13 @@ public class TestXA extends TestBase {
XAResource res = xa.getXAResource(); XAResource res = xa.getXAResource();
res.start(xid, XAResource.TMNOFLAGS); res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMSUCCESS); res.end(xid, XAResource.TMSUCCESS);
res.commit(xid, true); res.commit(xid, true);
assertTrue(c.getAutoCommit()); assertTrue(c.getAutoCommit());
res.start(xid, XAResource.TMNOFLAGS); res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMFAIL); res.end(xid, XAResource.TMFAIL);
res.rollback(xid); res.rollback(xid);
assertTrue(c.getAutoCommit()); assertTrue(c.getAutoCommit());
...@@ -193,7 +193,7 @@ public class TestXA extends TestBase { ...@@ -193,7 +193,7 @@ public class TestXA extends TestBase {
xa.getXAResource().start(xid, xa.getXAResource().start(xid,
XAResource.TMNOFLAGS); XAResource.TMNOFLAGS);
Connection c = xa.getConnection(); Connection c = xa.getConnection();
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
c.close(); c.close();
xa.close(); xa.close();
} }
......
...@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase { ...@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase {
for (String f : FileUtils.newDirectoryStream( for (String f : FileUtils.newDirectoryStream(
"zip:" + getBaseDir() + "/fsJar.zip")) { "zip:" + getBaseDir() + "/fsJar.zip")) {
assertFalse(FileUtils.isAbsolute(f)); assertFalse(FileUtils.isAbsolute(f));
assertTrue(!FileUtils.isDirectory(f)); assertFalse(FileUtils.isDirectory(f));
assertTrue(FileUtils.size(f) > 0); assertTrue(FileUtils.size(f) > 0);
assertTrue(f.endsWith(FileUtils.getName(f))); assertTrue(f.endsWith(FileUtils.getName(f)));
assertEquals(0, FileUtils.lastModified(f)); assertEquals(0, FileUtils.lastModified(f));
...@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase { ...@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase {
IOUtils.copyFiles(fsBase + "/test", fsBase + "/test3"); IOUtils.copyFiles(fsBase + "/test", fsBase + "/test3");
FileUtils.move(fsBase + "/test3", fsBase + "/test2"); FileUtils.move(fsBase + "/test3", fsBase + "/test2");
FileUtils.move(fsBase + "/test2", fsBase + "/test2"); FileUtils.move(fsBase + "/test2", fsBase + "/test2");
assertTrue(!FileUtils.exists(fsBase + "/test3")); assertFalse(FileUtils.exists(fsBase + "/test3"));
assertTrue(FileUtils.exists(fsBase + "/test2")); assertTrue(FileUtils.exists(fsBase + "/test2"));
assertEquals(10000, FileUtils.size(fsBase + "/test2")); assertEquals(10000, FileUtils.size(fsBase + "/test2"));
byte[] buffer2 = new byte[10000]; byte[] buffer2 = new byte[10000];
...@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase { ...@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase {
assertTrue(FileUtils.isDirectory(fsBase + "/testDir")); assertTrue(FileUtils.isDirectory(fsBase + "/testDir"));
if (!fsBase.startsWith("jdbc:")) { if (!fsBase.startsWith("jdbc:")) {
FileUtils.deleteRecursive(fsBase + "/testDir", false); FileUtils.deleteRecursive(fsBase + "/testDir", false);
assertTrue(!FileUtils.exists(fsBase + "/testDir")); assertFalse(FileUtils.exists(fsBase + "/testDir"));
} }
} }
} }
......
...@@ -760,7 +760,7 @@ public class TestTools extends TestBase { ...@@ -760,7 +760,7 @@ public class TestTools extends TestBase {
assertEquals(Double.MIN_VALUE, rs.getDouble("b")); assertEquals(Double.MIN_VALUE, rs.getDouble("b"));
assertEquals(Long.MIN_VALUE, rs.getLong("c")); assertEquals(Long.MIN_VALUE, rs.getLong("c"));
assertEquals(Short.MIN_VALUE, rs.getShort("d")); 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(new byte[] { (byte) 10, (byte) 20 }, rs.getBytes("f"));
assertEquals("2007-12-31", rs.getString("g")); assertEquals("2007-12-31", rs.getString("g"));
assertEquals("23:59:59", rs.getString("h")); assertEquals("23:59:59", rs.getString("h"));
......
...@@ -302,7 +302,7 @@ public class TestValue extends TestBase { ...@@ -302,7 +302,7 @@ public class TestValue extends TestBase {
for (int i = 0; i < d.length - 1; i++) { for (int i = 0; i < d.length - 1; i++) {
assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0); assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSafe(values[i], 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论