diff options
Diffstat (limited to 'test')
3 files changed, 28 insertions, 13 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index 828f76d..63c0add 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -101,6 +101,27 @@ public class DatabaseTest extends TestCase { } + public void testUnsupportedCreate() throws Exception { + try { + create(JetFormatTest.UNSUPPORTED_TEST_V1997.getExpectedFileFormat()); + fail("Create unsupported JetFormat should fail."); + } catch (IllegalArgumentException e) { + assertEquals(Database.MSG_PREFIX_CREATE_UNSUPPORTED_FILE_FORMAT + FileFormat.V1997, e.getMessage()); + } + } + + public void testUnsupportedOpen() throws Exception { + try { + open(JetFormatTest.UNSUPPORTED_TEST_V1997); + fail("Open unsupported JetFormat should fail."); + } catch (IllegalArgumentException e) { + assertEquals( + MSG_PREFIX_OPEN_UNSUPPORTED_JET_FORMAT + UNSUPPORTED_TEST_V1997.getExpectedFormat(), + e.getMessage()); + } + } + + public void testInvalidTableDefs() throws Exception { for (final FileFormat fileFormat : SUPPORTED_FILEFORMATS) { Database db = create(fileFormat); @@ -783,15 +804,9 @@ public class DatabaseTest extends TestCase { String lval = createString(255); // "--255 chars long text--"; - if (FileFormat.V2007.equals(testDB.getExpectedFileFormat())) { - // @todo Field order differs with V2007 - System.err.println("\n*** TODO: " + getName() - + "(): Is OK that " + testDB.getExpectedFileFormat().name() + " field order differs? ***"); - } - for(int i = 0; i < 1000; ++i) { if (FileFormat.V2007.equals(testDB.getExpectedFileFormat())) { - // @todo Field order differs with V2007 + // Field order differs with V2007 t.addRow(i, 13, 57, lval, lval, lval, lval, lval, lval, 47.0d); } else { t.addRow(i, 13, 57, 47.0d, lval, lval, lval, lval, lval, lval); @@ -986,9 +1001,7 @@ public class DatabaseTest extends TestCase { && !FileFormat.V2007.equals(fileFormat)) { assertNotNull("file format: " + fileFormat, db.getSystemTable("MSysAccessObjects")); } else { - // @todo Does is matter that v2003, v2007 template files have no "MSysAccessObjects" table? - System.err.println("\n*** TODO: " + getName() - + "(): Is OK that " + fileFormat.name() + " template file has no \"MSysAccessObjects\" table? ***"); + // v2003, v2007 template files have no "MSysAccessObjects" table assertNull("file format: " + fileFormat, db.getSystemTable("MSysAccessObjects")); } diff --git a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java index 96365e4..a51e865 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java @@ -50,7 +50,6 @@ public final class JetFormatTest extends TestCase { Database.FileFormat.V2000, Database.FileFormat.V2003, Database.FileFormat.V2007, - // @todo Uncomment these elements to run test other formats }; /** diff --git a/test/src/java/com/healthmarketscience/jackcess/UsageMapTest.java b/test/src/java/com/healthmarketscience/jackcess/UsageMapTest.java index 85b0630..4d55449 100644 --- a/test/src/java/com/healthmarketscience/jackcess/UsageMapTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/UsageMapTest.java @@ -5,6 +5,7 @@ import junit.framework.TestCase; import java.io.File; import java.io.IOException; +import static com.healthmarketscience.jackcess.Database.MSG_PREFIX_OPEN_UNSUPPORTED_JET_FORMAT; import static com.healthmarketscience.jackcess.JetFormatTest.*; /** @@ -18,8 +19,10 @@ public final class UsageMapTest extends TestCase { try { Database.open(UNSUPPORTED_TEST_V1997.getFile()); fail("mdb v97 usage map unsupported"); - } catch (IOException e) { - assertEquals(UsageMap.MSG_PREFIX_UNRECOGNIZED_MAP + 2, e.getMessage()); + } catch (IllegalArgumentException e) { + assertEquals( + MSG_PREFIX_OPEN_UNSUPPORTED_JET_FORMAT + UNSUPPORTED_TEST_V1997.getExpectedFormat(), + e.getMessage()); } for (final TestDB testDB : SUPPORTED_DBS_TEST) { |