Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
25cbca39
提交
25cbca39
authored
3月 19, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add and use TestBase.assertNotNull()
上级
7e67a879
显示空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
75 行增加
和
50 行删除
+75
-50
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+25
-0
AbstractBaseForCommonTableExpressions.java
...org/h2/test/db/AbstractBaseForCommonTableExpressions.java
+1
-1
TestDeadlock.java
h2/src/test/org/h2/test/db/TestDeadlock.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+1
-1
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+2
-2
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+2
-2
TestSynonymForTable.java
h2/src/test/org/h2/test/db/TestSynonymForTable.java
+1
-1
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+1
-1
UpdateTest.java
h2/src/test/org/h2/test/jaqu/UpdateTest.java
+2
-2
TestBatchUpdates.java
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
+4
-4
TestGetGeneratedKeys.java
h2/src/test/org/h2/test/jdbc/TestGetGeneratedKeys.java
+4
-4
TestMetaData.java
h2/src/test/org/h2/test/jdbc/TestMetaData.java
+1
-1
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+1
-1
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+4
-4
RecoverLobTest.java
h2/src/test/org/h2/test/recover/RecoverLobTest.java
+1
-1
TestCacheLIRS.java
h2/src/test/org/h2/test/store/TestCacheLIRS.java
+3
-3
TestCacheLongKeyLIRS.java
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
+3
-3
TestDataUtils.java
h2/src/test/org/h2/test/store/TestDataUtils.java
+1
-1
TestMVRTree.java
h2/src/test/org/h2/test/store/TestMVRTree.java
+4
-4
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+4
-4
TestMVStoreBenchmark.java
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
+1
-1
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+1
-1
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+4
-4
TestNetUtils.java
h2/src/test/org/h2/test/unit/TestNetUtils.java
+1
-1
TestColumnNamer.java
h2/src/test/org/h2/test/utils/TestColumnNamer.java
+1
-1
没有找到文件。
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
25cbca39
...
@@ -974,6 +974,31 @@ public abstract class TestBase {
...
@@ -974,6 +974,31 @@ public abstract class TestBase {
}
}
}
}
/**
* Check that the passed object is not null.
*
* @param obj the object
* @throws AssertionError if the condition is false
*/
public
void
assertNotNull
(
Object
obj
)
{
if
(
obj
==
null
)
{
fail
(
"Expected: not null got: null"
);
}
}
/**
* Check that the passed object is not null.
*
* @param message the message to print if the condition is false
* @param obj the object
* @throws AssertionError if the condition is false
*/
public
void
assertNotNull
(
String
message
,
Object
obj
)
{
if
(
obj
==
null
)
{
fail
(
message
);
}
}
/**
/**
* Check that the passed boolean is true.
* Check that the passed boolean is true.
*
*
...
...
h2/src/test/org/h2/test/db/AbstractBaseForCommonTableExpressions.java
浏览文件 @
25cbca39
...
@@ -57,7 +57,7 @@ public abstract class AbstractBaseForCommonTableExpressions extends TestBase {
...
@@ -57,7 +57,7 @@ public abstract class AbstractBaseForCommonTableExpressions extends TestBase {
rs
=
prep
.
executeQuery
();
rs
=
prep
.
executeQuery
();
for
(
int
columnIndex
=
1
;
columnIndex
<=
rs
.
getMetaData
().
getColumnCount
();
columnIndex
++)
{
for
(
int
columnIndex
=
1
;
columnIndex
<=
rs
.
getMetaData
().
getColumnCount
();
columnIndex
++)
{
assert
True
(
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
!=
null
);
assert
NotNull
(
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
);
assertEquals
(
expectedColumnNames
[
columnIndex
-
1
],
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
));
assertEquals
(
expectedColumnNames
[
columnIndex
-
1
],
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
));
assertEquals
(
assertEquals
(
"wrong type of column "
+
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
+
" on iteration #"
"wrong type of column "
+
rs
.
getMetaData
().
getColumnLabel
(
columnIndex
)
+
" on iteration #"
...
...
h2/src/test/org/h2/test/db/TestDeadlock.java
浏览文件 @
25cbca39
...
@@ -390,7 +390,7 @@ public class TestDeadlock extends TestBase {
...
@@ -390,7 +390,7 @@ public class TestDeadlock extends TestBase {
}
}
private
void
checkDeadlock
()
throws
SQLException
{
private
void
checkDeadlock
()
throws
SQLException
{
assert
True
(
lastException
!=
null
);
assert
NotNull
(
lastException
);
assertKnownException
(
lastException
);
assertKnownException
(
lastException
);
assertEquals
(
ErrorCode
.
DEADLOCK_1
,
lastException
.
getErrorCode
());
assertEquals
(
ErrorCode
.
DEADLOCK_1
,
lastException
.
getErrorCode
());
SQLException
e2
=
lastException
.
getNextException
();
SQLException
e2
=
lastException
.
getNextException
();
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
25cbca39
...
@@ -520,7 +520,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -520,7 +520,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
stat
.
execute
(
"delete from test"
);
stat
.
execute
(
"delete from test"
);
rs
=
stat
.
executeQuery
(
"call transaction_id()"
);
rs
=
stat
.
executeQuery
(
"call transaction_id()"
);
rs
.
next
();
rs
.
next
();
assert
True
(
rs
.
getString
(
1
)
!=
null
);
assert
NotNull
(
rs
.
getString
(
1
)
);
stat
.
execute
(
"drop table test"
);
stat
.
execute
(
"drop table test"
);
conn
.
close
();
conn
.
close
();
}
}
...
...
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
25cbca39
...
@@ -350,7 +350,7 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -350,7 +350,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread
.
sleep
(
200
);
Thread
.
sleep
(
200
);
stat
.
cancel
();
stat
.
cancel
();
SQLException
e
=
(
SQLException
)
task
.
getException
();
SQLException
e
=
(
SQLException
)
task
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
stat
.
execute
(
"set throttle 1000"
);
stat
.
execute
(
"set throttle 1000"
);
...
@@ -367,7 +367,7 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -367,7 +367,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread
.
sleep
(
200
);
Thread
.
sleep
(
200
);
stat
.
cancel
();
stat
.
cancel
();
e
=
(
SQLException
)
task
.
getException
();
e
=
(
SQLException
)
task
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
conn
.
close
();
conn
.
close
();
...
...
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
25cbca39
...
@@ -914,7 +914,7 @@ public class TestSpatial extends TestBase {
...
@@ -914,7 +914,7 @@ public class TestSpatial extends TestBase {
count
++;
count
++;
int
id
=
rs
.
getInt
(
1
);
int
id
=
rs
.
getInt
(
1
);
if
(
id
==
3
||
id
==
6
)
{
if
(
id
==
3
||
id
==
6
)
{
assert
True
(
rs
.
getObject
(
2
)
!=
null
);
assert
NotNull
(
rs
.
getObject
(
2
)
);
}
else
{
}
else
{
assertNull
(
rs
.
getObject
(
2
));
assertNull
(
rs
.
getObject
(
2
));
}
}
...
@@ -933,7 +933,7 @@ public class TestSpatial extends TestBase {
...
@@ -933,7 +933,7 @@ public class TestSpatial extends TestBase {
count
=
0
;
count
=
0
;
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
count
++;
count
++;
assert
True
(
rs
.
getObject
(
2
)
!=
null
);
assert
NotNull
(
rs
.
getObject
(
2
)
);
}
}
assertEquals
(
2
,
count
);
assertEquals
(
2
,
count
);
...
...
h2/src/test/org/h2/test/db/TestSynonymForTable.java
浏览文件 @
25cbca39
...
@@ -184,7 +184,7 @@ public class TestSynonymForTable extends TestBase {
...
@@ -184,7 +184,7 @@ public class TestSynonymForTable extends TestBase {
assertEquals
(
"BACKINGTABLE"
,
synonyms
.
getString
(
"SYNONYM_FOR"
));
assertEquals
(
"BACKINGTABLE"
,
synonyms
.
getString
(
"SYNONYM_FOR"
));
assertEquals
(
"VALID"
,
synonyms
.
getString
(
"STATUS"
));
assertEquals
(
"VALID"
,
synonyms
.
getString
(
"STATUS"
));
assertEquals
(
""
,
synonyms
.
getString
(
"REMARKS"
));
assertEquals
(
""
,
synonyms
.
getString
(
"REMARKS"
));
assert
True
(
synonyms
.
getString
(
"ID"
)
!=
null
);
assert
NotNull
(
synonyms
.
getString
(
"ID"
)
);
assertFalse
(
synonyms
.
next
());
assertFalse
(
synonyms
.
next
());
conn
.
close
();
conn
.
close
();
}
}
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
25cbca39
...
@@ -507,7 +507,7 @@ public class TestTableEngines extends TestBase {
...
@@ -507,7 +507,7 @@ public class TestTableEngines extends TestBase {
stat
.
executeUpdate
(
"CREATE TABLE T(ID INT AFFINITY PRIMARY KEY, NAME VARCHAR, AGE INT)"
+
stat
.
executeUpdate
(
"CREATE TABLE T(ID INT AFFINITY PRIMARY KEY, NAME VARCHAR, AGE INT)"
+
" ENGINE \""
+
AffinityTableEngine
.
class
.
getName
()
+
"\""
);
" ENGINE \""
+
AffinityTableEngine
.
class
.
getName
()
+
"\""
);
Table
tbl
=
AffinityTableEngine
.
createdTbl
;
Table
tbl
=
AffinityTableEngine
.
createdTbl
;
assert
True
(
tbl
!=
nul
l
);
assert
NotNull
(
tb
l
);
assertEquals
(
3
,
tbl
.
getIndexes
().
size
());
assertEquals
(
3
,
tbl
.
getIndexes
().
size
());
Index
aff
=
tbl
.
getIndexes
().
get
(
2
);
Index
aff
=
tbl
.
getIndexes
().
get
(
2
);
assertTrue
(
aff
.
getIndexType
().
isAffinity
());
assertTrue
(
aff
.
getIndexType
().
isAffinity
());
...
...
h2/src/test/org/h2/test/jaqu/UpdateTest.java
浏览文件 @
25cbca39
...
@@ -75,7 +75,7 @@ public class UpdateTest extends TestBase {
...
@@ -75,7 +75,7 @@ public class UpdateTest extends TestBase {
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
assert
True
(
"updated order not found"
,
ourUpdatedOrder
!=
null
);
assert
NotNull
(
"updated order not found"
,
ourUpdatedOrder
);
// undo update
// undo update
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
...
@@ -113,7 +113,7 @@ public class UpdateTest extends TestBase {
...
@@ -113,7 +113,7 @@ public class UpdateTest extends TestBase {
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
Order
ourUpdatedOrder
=
db
.
from
(
o
).
where
(
o
.
orderDate
)
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
.
is
(
valueOf
(
"2007-01-03"
)).
selectFirst
();
assert
True
(
"updated order not found"
,
ourUpdatedOrder
!=
null
);
assert
NotNull
(
"updated order not found"
,
ourUpdatedOrder
);
// undo update
// undo update
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
ourOrder
.
orderDate
=
valueOf
(
"2007-01-02"
);
...
...
h2/src/test/org/h2/test/jdbc/TestBatchUpdates.java
浏览文件 @
25cbca39
...
@@ -79,10 +79,10 @@ public class TestBatchUpdates extends TestBase {
...
@@ -79,10 +79,10 @@ public class TestBatchUpdates extends TestBase {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
assertContains
(
e
.
toString
(),
"TEST_Y"
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assertNull
(
e
);
assertNull
(
e
);
...
@@ -98,10 +98,10 @@ public class TestBatchUpdates extends TestBase {
...
@@ -98,10 +98,10 @@ public class TestBatchUpdates extends TestBase {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
assertContains
(
e
.
toString
(),
"TEST_Y"
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
assertContains
(
e
.
toString
(),
"TEST_Y"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
assertContains
(
e
.
toString
(),
"TEST_X"
);
e
=
e
.
getNextException
();
e
=
e
.
getNextException
();
assertNull
(
e
);
assertNull
(
e
);
...
...
h2/src/test/org/h2/test/jdbc/TestGetGeneratedKeys.java
浏览文件 @
25cbca39
...
@@ -130,19 +130,19 @@ public class TestGetGeneratedKeys extends TestBase {
...
@@ -130,19 +130,19 @@ public class TestGetGeneratedKeys extends TestBase {
rs
.
next
();
rs
.
next
();
assertEquals
(
1L
,
rs
.
getLong
(
1
));
assertEquals
(
1L
,
rs
.
getLong
(
1
));
UUID
u1
=
(
UUID
)
rs
.
getObject
(
2
);
UUID
u1
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u1
!=
null
);
assert
NotNull
(
u1
);
rs
.
next
();
rs
.
next
();
assertEquals
(
2L
,
rs
.
getLong
(
1
));
assertEquals
(
2L
,
rs
.
getLong
(
1
));
UUID
u2
=
(
UUID
)
rs
.
getObject
(
2
);
UUID
u2
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u2
!=
null
);
assert
NotNull
(
u2
);
rs
.
next
();
rs
.
next
();
assertEquals
(
3L
,
rs
.
getLong
(
1
));
assertEquals
(
3L
,
rs
.
getLong
(
1
));
UUID
u3
=
(
UUID
)
rs
.
getObject
(
2
);
UUID
u3
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u3
!=
null
);
assert
NotNull
(
u3
);
rs
.
next
();
rs
.
next
();
assertEquals
(
4L
,
rs
.
getLong
(
1
));
assertEquals
(
4L
,
rs
.
getLong
(
1
));
UUID
u4
=
(
UUID
)
rs
.
getObject
(
2
);
UUID
u4
=
(
UUID
)
rs
.
getObject
(
2
);
assert
True
(
u4
!=
null
);
assert
NotNull
(
u4
);
assertFalse
(
rs
.
next
());
assertFalse
(
rs
.
next
());
assertFalse
(
u1
.
equals
(
u2
));
assertFalse
(
u1
.
equals
(
u2
));
assertFalse
(
u2
.
equals
(
u3
));
assertFalse
(
u2
.
equals
(
u3
));
...
...
h2/src/test/org/h2/test/jdbc/TestMetaData.java
浏览文件 @
25cbca39
...
@@ -127,7 +127,7 @@ public class TestMetaData extends TestBase {
...
@@ -127,7 +127,7 @@ public class TestMetaData extends TestBase {
rs
=
stat
.
executeQuery
(
"select 1 from dual"
);
rs
=
stat
.
executeQuery
(
"select 1 from dual"
);
rs
.
next
();
rs
.
next
();
rsMeta
=
rs
.
getMetaData
();
rsMeta
=
rs
.
getMetaData
();
assert
True
(
rsMeta
.
getCatalogName
(
1
)
!=
null
);
assert
NotNull
(
rsMeta
.
getCatalogName
(
1
)
);
assertEquals
(
"1"
,
rsMeta
.
getColumnLabel
(
1
));
assertEquals
(
"1"
,
rsMeta
.
getColumnLabel
(
1
));
assertEquals
(
"1"
,
rsMeta
.
getColumnName
(
1
));
assertEquals
(
"1"
,
rsMeta
.
getColumnName
(
1
));
assertEquals
(
""
,
rsMeta
.
getSchemaName
(
1
));
assertEquals
(
""
,
rsMeta
.
getSchemaName
(
1
));
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
25cbca39
...
@@ -404,7 +404,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -404,7 +404,7 @@ public class TestPreparedStatement extends TestBase {
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
prep
.
cancel
();
prep
.
cancel
();
SQLException
e
=
(
SQLException
)
t
.
getException
();
SQLException
e
=
(
SQLException
)
t
.
getException
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
assertEquals
(
ErrorCode
.
STATEMENT_WAS_CANCELED
,
e
.
getErrorCode
());
prep
.
setInt
(
1
,
1
);
prep
.
setInt
(
1
,
1
);
prep
.
setInt
(
2
,
1
);
prep
.
setInt
(
2
,
1
);
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
25cbca39
...
@@ -1597,7 +1597,7 @@ public class TestResultSet extends TestBase {
...
@@ -1597,7 +1597,7 @@ public class TestResultSet extends TestBase {
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
b
);
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
b
);
Blob
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
Blob
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x0b
,
(
byte
)
0xce
,
(
byte
)
0xc1
},
readAllBytes
(
blob
.
getBinaryStream
()));
readAllBytes
(
blob
.
getBinaryStream
()));
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0xce
,
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0xce
,
...
@@ -1611,7 +1611,7 @@ public class TestResultSet extends TestBase {
...
@@ -1611,7 +1611,7 @@ public class TestResultSet extends TestBase {
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
(
byte
)
0x03
,
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
(
byte
)
0x03
,
(
byte
)
0x03
,
(
byte
)
0x03
},
readAllBytes
(
blob
.
getBinaryStream
()));
(
byte
)
0x03
,
(
byte
)
0x03
},
readAllBytes
(
blob
.
getBinaryStream
()));
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
assertEqualsWithNull
(
new
byte
[]
{
(
byte
)
0x03
,
...
@@ -1629,7 +1629,7 @@ public class TestResultSet extends TestBase {
...
@@ -1629,7 +1629,7 @@ public class TestResultSet extends TestBase {
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
blob
=
rs
.
getObject
(
"value"
,
Blob
.
class
);
try
{
try
{
assert
True
(
blob
!=
null
);
assert
NotNull
(
blob
);
assertEqualsWithNull
(
random
,
readAllBytes
(
blob
.
getBinaryStream
()));
assertEqualsWithNull
(
random
,
readAllBytes
(
blob
.
getBinaryStream
()));
byte
[]
expected
=
Arrays
.
copyOfRange
(
random
,
100
,
50102
);
byte
[]
expected
=
Arrays
.
copyOfRange
(
random
,
100
,
50102
);
byte
[]
got
=
readAllBytes
(
blob
.
getBinaryStream
(
101
,
50002
));
byte
[]
got
=
readAllBytes
(
blob
.
getBinaryStream
(
101
,
50002
));
...
@@ -1715,7 +1715,7 @@ public class TestResultSet extends TestBase {
...
@@ -1715,7 +1715,7 @@ public class TestResultSet extends TestBase {
clob
=
rs
.
getObject
(
"value"
,
Clob
.
class
);
clob
=
rs
.
getObject
(
"value"
,
Clob
.
class
);
try
{
try
{
assert
True
(
clob
!=
null
);
assert
NotNull
(
clob
);
string
=
readString
(
clob
.
getCharacterStream
());
string
=
readString
(
clob
.
getCharacterStream
());
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Test2"
));
assertTrue
(
string
!=
null
&&
string
.
equals
(
"Test2"
));
assertFalse
(
rs
.
wasNull
());
assertFalse
(
rs
.
wasNull
());
...
...
h2/src/test/org/h2/test/recover/RecoverLobTest.java
浏览文件 @
25cbca39
...
@@ -69,7 +69,7 @@ public class RecoverLobTest extends TestBase {
...
@@ -69,7 +69,7 @@ public class RecoverLobTest extends TestBase {
int
id
=
rs
.
getInt
(
1
);
int
id
=
rs
.
getInt
(
1
);
String
data
=
rs
.
getString
(
2
);
String
data
=
rs
.
getString
(
2
);
assert
True
(
data
!=
null
);
assert
NotNull
(
data
);
assertTrue
(
data
.
length
()
==
10000
*
id
);
assertTrue
(
data
.
length
()
==
10000
*
id
);
}
}
...
...
h2/src/test/org/h2/test/store/TestCacheLIRS.java
浏览文件 @
25cbca39
...
@@ -449,8 +449,8 @@ public class TestCacheLIRS extends TestBase {
...
@@ -449,8 +449,8 @@ public class TestCacheLIRS extends TestBase {
Integer
x
=
test
.
get
(
i
);
Integer
x
=
test
.
get
(
i
);
Integer
y
=
test
.
peek
(
i
);
Integer
y
=
test
.
peek
(
i
);
if
(
i
<
size
/
2
)
{
if
(
i
<
size
/
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assert
True
(
"i: "
+
i
,
y
!=
null
);
assert
NotNull
(
"i: "
+
i
,
y
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
}
else
{
}
else
{
...
@@ -469,7 +469,7 @@ public class TestCacheLIRS extends TestBase {
...
@@ -469,7 +469,7 @@ public class TestCacheLIRS extends TestBase {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Integer
x
=
test
.
get
(
i
);
Integer
x
=
test
.
get
(
i
);
if
(
i
<
size
/
2
||
i
==
size
-
1
)
{
if
(
i
<
size
/
2
||
i
==
size
-
1
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
x
.
intValue
());
}
else
{
}
else
{
assertNull
(
x
);
assertNull
(
x
);
...
...
h2/src/test/org/h2/test/store/TestCacheLongKeyLIRS.java
浏览文件 @
25cbca39
...
@@ -378,8 +378,8 @@ public class TestCacheLongKeyLIRS extends TestBase {
...
@@ -378,8 +378,8 @@ public class TestCacheLongKeyLIRS extends TestBase {
Integer
x
=
test
.
get
(
i
);
Integer
x
=
test
.
get
(
i
);
Integer
y
=
test
.
peek
(
i
);
Integer
y
=
test
.
peek
(
i
);
if
(
i
<
size
/
2
)
{
if
(
i
<
size
/
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assert
True
(
"i: "
+
i
,
y
!=
null
);
assert
NotNull
(
"i: "
+
i
,
y
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
assertEquals
(
i
*
10
,
y
.
intValue
());
}
else
{
}
else
{
...
@@ -398,7 +398,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
...
@@ -398,7 +398,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Integer
x
=
test
.
get
(
i
);
Integer
x
=
test
.
get
(
i
);
if
(
i
<
size
/
2
||
i
==
size
-
1
||
i
==
size
-
2
)
{
if
(
i
<
size
/
2
||
i
==
size
-
1
||
i
==
size
-
2
)
{
assert
True
(
"i: "
+
i
,
x
!=
null
);
assert
NotNull
(
"i: "
+
i
,
x
);
assertEquals
(
i
*
10
,
x
.
intValue
());
assertEquals
(
i
*
10
,
x
.
intValue
());
}
else
{
}
else
{
assertNull
(
x
);
assertNull
(
x
);
...
...
h2/src/test/org/h2/test/store/TestDataUtils.java
浏览文件 @
25cbca39
...
@@ -141,7 +141,7 @@ public class TestDataUtils extends TestBase {
...
@@ -141,7 +141,7 @@ public class TestDataUtils extends TestBase {
}
}
try
{
try
{
HashMap
<
String
,
String
>
map
=
DataUtils
.
parseMap
(
buff
.
toString
());
HashMap
<
String
,
String
>
map
=
DataUtils
.
parseMap
(
buff
.
toString
());
assert
False
(
map
==
null
);
assert
NotNull
(
map
);
// ok
// ok
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
// ok - but not another exception
// ok - but not another exception
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
25cbca39
...
@@ -134,7 +134,7 @@ public class TestMVRTree extends TestMVStore {
...
@@ -134,7 +134,7 @@ public class TestMVRTree extends TestMVStore {
for
(
SpatialKey
k
;
it
.
hasNext
();)
{
for
(
SpatialKey
k
;
it
.
hasNext
();)
{
k
=
it
.
next
();
k
=
it
.
next
();
// System.out.println(k + ": " + r.get(k));
// System.out.println(k + ": " + r.get(k));
assert
True
(
k
!=
null
);
assert
NotNull
(
k
);
}
}
s
.
close
();
s
.
close
();
}
}
...
@@ -181,7 +181,7 @@ public class TestMVRTree extends TestMVStore {
...
@@ -181,7 +181,7 @@ public class TestMVRTree extends TestMVStore {
assertEquals
(
len
,
r
.
size
());
assertEquals
(
len
,
r
.
size
());
int
count
=
0
;
int
count
=
0
;
for
(
SpatialKey
k
:
r
.
keySet
())
{
for
(
SpatialKey
k
:
r
.
keySet
())
{
assert
True
(
r
.
get
(
k
)
!=
null
);
assert
NotNull
(
r
.
get
(
k
)
);
count
++;
count
++;
}
}
assertEquals
(
len
,
count
);
assertEquals
(
len
,
count
);
...
@@ -413,7 +413,7 @@ public class TestMVRTree extends TestMVStore {
...
@@ -413,7 +413,7 @@ public class TestMVRTree extends TestMVStore {
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
SpatialKey
n
=
it
.
next
();
SpatialKey
n
=
it
.
next
();
String
a
=
map
.
get
(
n
);
String
a
=
map
.
get
(
n
);
assert
False
(
a
==
null
);
assert
NotNull
(
a
);
}
}
break
;
break
;
}
}
...
@@ -424,7 +424,7 @@ public class TestMVRTree extends TestMVStore {
...
@@ -424,7 +424,7 @@ public class TestMVRTree extends TestMVStore {
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
SpatialKey
n
=
it
.
next
();
SpatialKey
n
=
it
.
next
();
String
a
=
map
.
get
(
n
);
String
a
=
map
.
get
(
n
);
assert
False
(
a
==
null
);
assert
NotNull
(
a
);
}
}
break
;
break
;
}
}
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
25cbca39
...
@@ -528,7 +528,7 @@ public class TestMVStore extends TestBase {
...
@@ -528,7 +528,7 @@ public class TestMVStore extends TestBase {
sleep
(
10
);
sleep
(
10
);
}
}
Throwable
e
=
exRef
.
get
();
Throwable
e
=
exRef
.
get
();
assert
True
(
e
!=
null
);
assert
NotNull
(
e
);
assertEquals
(
DataUtils
.
ERROR_WRITING_FAILED
,
assertEquals
(
DataUtils
.
ERROR_WRITING_FAILED
,
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
...
@@ -894,7 +894,7 @@ public class TestMVStore extends TestBase {
...
@@ -894,7 +894,7 @@ public class TestMVStore extends TestBase {
s
.
close
();
s
.
close
();
s
=
openStore
(
fileName
);
s
=
openStore
(
fileName
);
Object
test
=
s
.
getStoreHeader
().
get
(
"test"
);
Object
test
=
s
.
getStoreHeader
().
get
(
"test"
);
assert
False
(
test
==
null
);
assert
NotNull
(
test
);
assertEquals
(
"123"
,
test
.
toString
());
assertEquals
(
"123"
,
test
.
toString
());
s
.
close
();
s
.
close
();
}
}
...
@@ -1506,8 +1506,8 @@ public class TestMVStore extends TestBase {
...
@@ -1506,8 +1506,8 @@ public class TestMVStore extends TestBase {
s
.
setRetentionTime
(
45000
);
s
.
setRetentionTime
(
45000
);
assertEquals
(
2
,
s
.
getCurrentVersion
());
assertEquals
(
2
,
s
.
getCurrentVersion
());
meta
=
s
.
getMetaMap
();
meta
=
s
.
getMetaMap
();
assert
True
(
meta
.
get
(
"name.data"
)
!=
null
);
assert
NotNull
(
meta
.
get
(
"name.data"
)
);
assert
True
(
meta
.
get
(
"name.data0"
)
!=
null
);
assert
NotNull
(
meta
.
get
(
"name.data0"
)
);
assertNull
(
meta
.
get
(
"name.data1"
));
assertNull
(
meta
.
get
(
"name.data1"
));
m
=
s
.
openMap
(
"data"
);
m
=
s
.
openMap
(
"data"
);
m0
=
s
.
openMap
(
"data0"
);
m0
=
s
.
openMap
(
"data0"
);
...
...
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
浏览文件 @
25cbca39
...
@@ -174,7 +174,7 @@ public class TestMVStoreBenchmark extends TestBase {
...
@@ -174,7 +174,7 @@ public class TestMVStoreBenchmark extends TestBase {
for
(
int
a
=
0
;
a
<
5
;
a
++)
{
for
(
int
a
=
0
;
a
<
5
;
a
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
String
x
=
map
.
get
(
i
);
String
x
=
map
.
get
(
i
);
assert
True
(
x
!=
null
);
assert
NotNull
(
x
);
}
}
}
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
25cbca39
...
@@ -180,7 +180,7 @@ public class TestMVTableEngine extends TestBase {
...
@@ -180,7 +180,7 @@ public class TestMVTableEngine extends TestBase {
stat
.
execute
(
"checkpoint"
);
stat
.
execute
(
"checkpoint"
);
stat
.
execute
(
"shutdown immediately"
);
stat
.
execute
(
"shutdown immediately"
);
Exception
ex
=
t
.
getException
();
Exception
ex
=
t
.
getException
();
assert
True
(
ex
!=
null
);
assert
NotNull
(
ex
);
try
{
try
{
conn
.
close
();
conn
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
25cbca39
...
@@ -860,7 +860,7 @@ public class TestTransactionStore extends TestBase {
...
@@ -860,7 +860,7 @@ public class TestTransactionStore extends TestBase {
assertNull
(
map
.
get
(
x
));
assertNull
(
map
.
get
(
x
));
}
}
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
assert
True
(
map
.
get
(
x
)
!=
null
);
assert
NotNull
(
map
.
get
(
x
)
);
assertFalse
(
map
.
tryRemove
(
x
));
assertFalse
(
map
.
tryRemove
(
x
));
// PostgreSQL needs to rollback
// PostgreSQL needs to rollback
buff
.
append
(
" -> rollback"
);
buff
.
append
(
" -> rollback"
);
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
25cbca39
...
@@ -219,16 +219,16 @@ public class TestFileSystem extends TestBase {
...
@@ -219,16 +219,16 @@ public class TestFileSystem extends TestBase {
String
resource
=
"org/h2/test/scripts/testSimple.in.txt"
;
String
resource
=
"org/h2/test/scripts/testSimple.in.txt"
;
InputStream
in
;
InputStream
in
;
in
=
getClass
().
getResourceAsStream
(
"/"
+
resource
);
in
=
getClass
().
getResourceAsStream
(
"/"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
.
close
();
in
=
getClass
().
getClassLoader
().
getResourceAsStream
(
resource
);
in
=
getClass
().
getClassLoader
().
getResourceAsStream
(
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
.
close
();
in
=
FileUtils
.
newInputStream
(
"classpath:"
+
resource
);
in
=
FileUtils
.
newInputStream
(
"classpath:"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
.
close
();
in
=
FileUtils
.
newInputStream
(
"classpath:/"
+
resource
);
in
=
FileUtils
.
newInputStream
(
"classpath:/"
+
resource
);
assert
True
(
in
!=
null
);
assert
NotNull
(
in
);
in
.
close
();
in
.
close
();
}
}
...
...
h2/src/test/org/h2/test/unit/TestNetUtils.java
浏览文件 @
25cbca39
...
@@ -125,7 +125,7 @@ public class TestNetUtils extends TestBase {
...
@@ -125,7 +125,7 @@ public class TestNetUtils extends TestBase {
closeSilently
(
socket
);
closeSilently
(
socket
);
closeSilently
(
serverSocket
);
closeSilently
(
serverSocket
);
if
(
task
!=
null
)
{
if
(
task
!=
null
)
{
assert
True
(
task
.
getException
()
!=
null
);
assert
NotNull
(
task
.
getException
()
);
assertEquals
(
javax
.
net
.
ssl
.
SSLHandshakeException
.
class
.
getName
(),
assertEquals
(
javax
.
net
.
ssl
.
SSLHandshakeException
.
class
.
getName
(),
task
.
getException
().
getClass
().
getName
());
task
.
getException
().
getClass
().
getName
());
assertContains
(
task
.
getException
().
getMessage
(),
"certificate_unknown"
);
assertContains
(
task
.
getException
().
getMessage
(),
"certificate_unknown"
);
...
...
h2/src/test/org/h2/test/utils/TestColumnNamer.java
浏览文件 @
25cbca39
...
@@ -47,7 +47,7 @@ public class TestColumnNamer extends TestBase {
...
@@ -47,7 +47,7 @@ public class TestColumnNamer extends TestBase {
for
(
String
id
:
ids
)
{
for
(
String
id
:
ids
)
{
Expression
columnExp
=
ValueExpression
.
getDefault
();
Expression
columnExp
=
ValueExpression
.
getDefault
();
String
newColumnName
=
columnNamer
.
getColumnName
(
columnExp
,
index
+
1
,
id
);
String
newColumnName
=
columnNamer
.
getColumnName
(
columnExp
,
index
+
1
,
id
);
assert
True
(
newColumnName
!=
null
);
assert
NotNull
(
newColumnName
);
assertTrue
(
newColumnName
.
length
()
<=
30
);
assertTrue
(
newColumnName
.
length
()
<=
30
);
assertTrue
(
newColumnName
.
length
()
>=
1
);
assertTrue
(
newColumnName
.
length
()
>=
1
);
assertEquals
(
newColumnName
,
expectedColumnName
[
index
]);
assertEquals
(
newColumnName
,
expectedColumnName
[
index
]);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论