diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/TableTest.java | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/TableTest.java b/test/src/java/com/healthmarketscience/jackcess/TableTest.java index 041600a..5b22db0 100644 --- a/test/src/java/com/healthmarketscience/jackcess/TableTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/TableTest.java @@ -18,19 +18,24 @@ public class TableTest extends TestCase { } public void testCreateRow() throws Exception { - JetFormat format = JetFormat.VERSION_4; - Table table = new Table(true); + final JetFormat format = JetFormat.VERSION_4; + final PageChannel pageChannel = new PageChannel(true); List<Column> columns = new ArrayList<Column>(); - Column col = new Column(true); + Column col = newTestColumn(pageChannel); col.setType(DataType.INT); columns.add(col); - col = new Column(true); + col = newTestColumn(pageChannel); col.setType(DataType.TEXT); columns.add(col); - col = new Column(true); + col = newTestColumn(pageChannel); col.setType(DataType.TEXT); columns.add(col); - table.setColumns(columns); + Table table = new Table(true, columns) { + @Override + public PageChannel getPageChannel() { + return pageChannel; + } + }; int colCount = 3; Object[] row = new Object[colCount]; row[0] = new Short((short) 9); @@ -46,5 +51,18 @@ public class TableTest extends TestCase { assertEquals((short) 2, buffer.getShort(28)); assertEquals((byte) 7, buffer.get(30)); } + + private static Column newTestColumn(final PageChannel pageChannel) { + return new Column(true) { + @Override + public PageChannel getPageChannel() { + return pageChannel; + } + @Override + public JetFormat getFormat() { + return JetFormat.VERSION_4; + } + }; + } } |