diff options
author | Tim McCune <javajedi@users.sf.net> | 2005-04-07 14:32:19 +0000 |
---|---|---|
committer | Tim McCune <javajedi@users.sf.net> | 2005-04-07 14:32:19 +0000 |
commit | 08dcaee297433626be8ac74d0723a4b22001ed7e (patch) | |
tree | e360b4105fde834bbaca122640ea66258e0aa7b8 /test/src/java/com/healthmarketscience/jackcess/TableTest.java | |
download | jackcess-hms.tar.gz jackcess-hms.zip |
Imported sourceshms
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/hms@2 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test/src/java/com/healthmarketscience/jackcess/TableTest.java')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/TableTest.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/TableTest.java b/test/src/java/com/healthmarketscience/jackcess/TableTest.java new file mode 100644 index 0000000..cd8d522 --- /dev/null +++ b/test/src/java/com/healthmarketscience/jackcess/TableTest.java @@ -0,0 +1,51 @@ +// Copyright (c) 2004 Health Market Science, Inc. + +package com.healthmarketscience.jackcess; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; + +import com.healthmarketscience.jackcess.Column; +import com.healthmarketscience.jackcess.DataTypes; +import com.healthmarketscience.jackcess.Table; + +import junit.framework.TestCase; + +/** + * @author Tim McCune + */ +public class TableTest extends TestCase { + + public TableTest(String name) { + super(name); + } + + public void testCreateRow() throws Exception { + Table table = new Table(); + List columns = new ArrayList(); + Column col = new Column(); + col.setType(DataTypes.INT); + columns.add(col); + col = new Column(); + col.setType(DataTypes.TEXT); + columns.add(col); + columns.add(col); + table.setColumns(columns); + int colCount = 3; + Object[] row = new Object[colCount]; + row[0] = new Short((short) 9); + row[1] = "Tim"; + row[2] = "McCune"; + ByteBuffer buffer = table.createRow(row); + assertEquals((short) colCount, buffer.getShort()); + assertEquals((short) 9, buffer.getShort()); + assertEquals((byte) 'T', buffer.get()); + assertEquals((short) 22, buffer.getShort(22)); + assertEquals((short) 10, buffer.getShort(24)); + assertEquals((short) 4, buffer.getShort(26)); + assertEquals((short) 2, buffer.getShort(28)); + assertEquals((byte) 7, buffer.get(30)); + } + +} |