aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2014-09-29 22:10:43 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2014-09-29 22:10:43 +0000
commitf17433f2de69b70a89064eb88b543d5e51c61460 (patch)
treecaf515d15e01bd3f4833f76eac2b12d937603b7e /src/test/java
parent364584d16a48230e6dadc20d7f90fa910333de85 (diff)
downloadjackcess-f17433f2de69b70a89064eb88b543d5e51c61460.tar.gz
jackcess-f17433f2de69b70a89064eb88b543d5e51c61460.zip
fix regression where empty memo values are returned as null (issue 110)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@884 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java19
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java20
2 files changed, 37 insertions, 2 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
index a9178fe..a25c6e8 100644
--- a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
@@ -565,6 +565,8 @@ public class DatabaseTest extends TestCase
table.addRow(testStr, testStr, null);
table.addRow(testStr, longMemo, oleValue);
+ table.addRow("", "", new byte[0]);
+ table.addRow(null, null, null);
table.reset();
@@ -580,6 +582,18 @@ public class DatabaseTest extends TestCase
assertEquals(longMemo, row.get("B"));
assertTrue(Arrays.equals(oleValue, row.getBytes("C")));
+ row = table.getNextRow();
+
+ assertEquals("", row.get("A"));
+ assertEquals("", row.get("B"));
+ assertTrue(Arrays.equals(new byte[0], row.getBytes("C")));
+
+ row = table.getNextRow();
+
+ assertNull(row.get("A"));
+ assertNull(row.get("B"));
+ assertNull(row.getBytes("C"));
+
db.close();
}
}
@@ -1565,7 +1579,10 @@ public class DatabaseTest extends TestCase
for(Map<String, Object> row : cursor) {
foundTable.add(row);
}
- assertEquals(expectedTable, foundTable);
+ assertEquals(expectedTable.size(), foundTable.size());
+ for(int i = 0; i < expectedTable.size(); ++i) {
+ assertEquals(expectedTable.get(i), foundTable.get(i));
+ }
}
public static RowImpl createExpectedRow(Object... rowElements) {
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
index 26b2390..bbcd08c 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/CalcFieldTest.java
@@ -102,6 +102,8 @@ public class CalcFieldTest extends TestCase
t.addRow(Column.AUTO_NUMBER, "foo", "1_foo", longStr, true, 2, bd1);
t.addRow(Column.AUTO_NUMBER, "bar", "2_bar", longStr, false, -37, bd2);
+ t.addRow(Column.AUTO_NUMBER, "", "", "", false, 0, BigDecimal.ZERO);
+ t.addRow(Column.AUTO_NUMBER, null, null, null, null, null, null);
List<? extends Map<String, Object>> expectedRows =
createExpectedTable(
@@ -120,7 +122,23 @@ public class CalcFieldTest extends TestCase
"calc_memo", longStr,
"calc_bool", false,
"calc_long", -37,
- "calc_numeric", bd2));
+ "calc_numeric", bd2),
+ createExpectedRow(
+ "id", 3,
+ "data", "",
+ "calc_text", "",
+ "calc_memo", "",
+ "calc_bool", false,
+ "calc_long", 0,
+ "calc_numeric", BigDecimal.ZERO),
+ createExpectedRow(
+ "id", 4,
+ "data", null,
+ "calc_text", null,
+ "calc_memo", null,
+ "calc_bool", null,
+ "calc_long", null,
+ "calc_numeric", null));
assertTable(expectedRows, t);