From: James Ahlborn Date: Tue, 13 Jun 2006 16:44:48 +0000 (+0000) Subject: added tests for reading memos and missing files X-Git-Tag: rel_1_1_4~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ae48569aa03c476ed35af2cdc4afaf5c7fbe9704;p=jackcess.git added tests for reading memos and missing files git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@55 f203690c-595d-4dc9-a70b-905162fa7fd2 --- diff --git a/test/data/test2.mdb b/test/data/test2.mdb new file mode 100644 index 0000000..8da9633 Binary files /dev/null and b/test/data/test2.mdb differ diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index f72b6c6..a2d1ba1 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -3,6 +3,7 @@ package com.healthmarketscience.jackcess; import java.io.File; +import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -184,6 +185,29 @@ public class DatabaseTest extends TestCase { assertEquals(2, table.getNextRow().get("D")); } + public void testReadMemo() throws Exception { + + Database db = Database.open(new File("test/data/test2.mdb")); + String tableName = "MSP_PROJECTS"; + Table table = db.getTable(tableName); + Map row = table.getNextRow(); + assertEquals("Jon Iles this is a a vawesrasoih aksdkl fas dlkjflkasjd flkjaslkdjflkajlksj dfl lkasjdf lkjaskldfj lkas dlk lkjsjdfkl; aslkdf lkasjkldjf lka skldf lka sdkjfl;kasjd falksjdfljaslkdjf laskjdfk jalskjd flkj aslkdjflkjkjasljdflkjas jf;lkasjd fjkas dasdf asd fasdf asdf asdmhf lksaiyudfoi jasodfj902384jsdf9 aw90se fisajldkfj lkasj dlkfslkd jflksjadf as", row.get("PROJ_PROP_AUTHOR")); + assertEquals("T", row.get("PROJ_PROP_COMPANY")); + assertEquals("Standard", row.get("PROJ_INFO_CAL_NAME")); + assertEquals("Project1", row.get("PROJ_PROP_TITLE")); + } + + public void testMissingFile() throws Exception { + File bogusFile = new File("fooby-dooby.mdb"); + assertTrue(!bogusFile.exists()); + try { + Database db = Database.open(bogusFile); + fail("FileNotFoundException should have been thrown"); + } catch(FileNotFoundException e) { + } + assertTrue(!bogusFile.exists()); + } + private int countRows(Table table) throws Exception { table.reset(); int rtn = 0;