提交 0b1fee49 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improve code coverage.

上级 9e524d88
...@@ -10,11 +10,11 @@ import java.io.OutputStream; ...@@ -10,11 +10,11 @@ import java.io.OutputStream;
import java.io.Writer; import java.io.Writer;
import java.sql.Blob; import java.sql.Blob;
import java.sql.Clob; import java.sql.Clob;
import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Statement; import java.sql.Statement;
import java.util.Random; import java.util.Random;
import org.h2.jdbc.JdbcConnection;
import org.h2.test.TestBase; import org.h2.test.TestBase;
/** /**
...@@ -22,7 +22,7 @@ import org.h2.test.TestBase; ...@@ -22,7 +22,7 @@ import org.h2.test.TestBase;
*/ */
public class TestLob extends TestBase { public class TestLob extends TestBase {
private Connection conn; private JdbcConnection conn;
private Statement stat; private Statement stat;
/** /**
...@@ -37,10 +37,9 @@ public class TestLob extends TestBase { ...@@ -37,10 +37,9 @@ public class TestLob extends TestBase {
public void test() throws Exception { public void test() throws Exception {
deleteDb("lob"); deleteDb("lob");
conn = getConnection("lob"); conn = (JdbcConnection) getConnection("lob");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("create table test(id int, x blob)"); stat.execute("create table test(id int, x blob)");
//## Java 1.6 begin ##
testBlob(0); testBlob(0);
testBlob(1); testBlob(1);
testBlob(100); testBlob(100);
...@@ -51,12 +50,10 @@ public class TestLob extends TestBase { ...@@ -51,12 +50,10 @@ public class TestLob extends TestBase {
testClob(1); testClob(1);
testClob(100); testClob(100);
testClob(100000); testClob(100000);
//## Java 1.6 end ##
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
} }
//## Java 1.6 begin ##
private void testBlob(int length) throws Exception { private void testBlob(int length) throws Exception {
Random r = new Random(length); Random r = new Random(length);
byte[] data = new byte[length]; byte[] data = new byte[length];
...@@ -133,6 +130,5 @@ public class TestLob extends TestBase { ...@@ -133,6 +130,5 @@ public class TestLob extends TestBase {
s2 = c2.getSubString(1, length); s2 = c2.getSubString(1, length);
assertEquals(s, s2); assertEquals(s, s2);
} }
//## Java 1.6 end ##
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论