From: James Ahlborn Date: Wed, 7 Apr 2010 02:35:09 +0000 (+0000) Subject: reindent X-Git-Tag: jackcess-1.2.0~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8d9e7bb78edee3b0cca440f8a4cfaffc8cce767;p=jackcess.git reindent git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@458 f203690c-595d-4dc9-a70b-905162fa7fd2 --- diff --git a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java index c4b9b1f..d386af6 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JetFormatTest.java @@ -13,154 +13,154 @@ import junit.framework.TestCase; * Date: Mar 5, 2010 * Time: 12:44:21 PM */ -public final class JetFormatTest extends TestCase { - - private static final File DIR_TEST_DATA = new File("test/data"); - - /** - * Defines known valid db test file base names. - */ - public static enum Basename { - - BIG_INDEX("bigIndexTest"), - COMP_INDEX("compIndexTest"), - DEL_COL("delColTest"), - DEL("delTest"), - FIXED_NUMERIC("fixedNumericTest"), - FIXED_TEXT("fixedTextTest"), - INDEX_CURSOR("indexCursorTest"), - INDEX("indexTest"), - OVERFLOW("overflowTest"), - QUERY("queryTest"), - TEST("test"), - TEST2("test2"), - INDEX_CODES("testIndexCodes"), - INDEX_PROPERTIES("testIndexProperties"), - PROMOTION("testPromotion"), - ; - - private final String _basename; - - Basename(String fileBasename) { - _basename = fileBasename; - } - - @Override - public String toString() { return _basename; } +public class JetFormatTest extends TestCase { + + private static final File DIR_TEST_DATA = new File("test/data"); + + /** + * Defines known valid db test file base names. + */ + public static enum Basename { + + BIG_INDEX("bigIndexTest"), + COMP_INDEX("compIndexTest"), + DEL_COL("delColTest"), + DEL("delTest"), + FIXED_NUMERIC("fixedNumericTest"), + FIXED_TEXT("fixedTextTest"), + INDEX_CURSOR("indexCursorTest"), + INDEX("indexTest"), + OVERFLOW("overflowTest"), + QUERY("queryTest"), + TEST("test"), + TEST2("test2"), + INDEX_CODES("testIndexCodes"), + INDEX_PROPERTIES("testIndexProperties"), + PROMOTION("testPromotion"), + ; + + private final String _basename; + + Basename(String fileBasename) { + _basename = fileBasename; } - /** Defines currently supported db file formats. */ - final static Database.FileFormat[] SUPPORTED_FILEFORMATS = - new Database.FileFormat[] { - Database.FileFormat.V2000, - Database.FileFormat.V2003, - Database.FileFormat.V2007, - }; - - /** - * Defines known valid test database files, and their jet format version. - */ - public static final class TestDB { - - private final File dbFile; - private final Database.FileFormat expectedFileFormat; - - private TestDB(File databaseFile, - Database.FileFormat expectedDBFileFormat) { - - dbFile = databaseFile; - expectedFileFormat = expectedDBFileFormat; - } - - public final File getFile() { return dbFile; } - - public final Database.FileFormat getExpectedFileFormat() { - return expectedFileFormat; - } - - public final JetFormat getExpectedFormat() { - return expectedFileFormat.getJetFormat(); - } - - @Override - public final String toString() { - return "dbFile: " + dbFile.getAbsolutePath() - + "; expectedFileFormat: " + expectedFileFormat; - } - - public static List getSupportedForBasename(Basename basename) { - - List supportedTestDBs = new ArrayList(); - for (Database.FileFormat fileFormat : SUPPORTED_FILEFORMATS) { - supportedTestDBs.add(new TestDB( - getFileForBasename(basename, fileFormat), - fileFormat)); - } - return supportedTestDBs; - } - - private static File getFileForBasename( - Basename basename, Database.FileFormat fileFormat) { - - return new File(DIR_TEST_DATA, - fileFormat.name() + File.separator + - basename + fileFormat.name() + - fileFormat.getFileExtension()); - } + @Override + public String toString() { return _basename; } + } + + /** Defines currently supported db file formats. */ + final static Database.FileFormat[] SUPPORTED_FILEFORMATS = + new Database.FileFormat[] { + Database.FileFormat.V2000, + Database.FileFormat.V2003, + Database.FileFormat.V2007, + }; + + /** + * Defines known valid test database files, and their jet format version. + */ + public static final class TestDB { + + private final File dbFile; + private final Database.FileFormat expectedFileFormat; + + private TestDB(File databaseFile, + Database.FileFormat expectedDBFileFormat) { + + dbFile = databaseFile; + expectedFileFormat = expectedDBFileFormat; } - private static final File UNSUPPORTED_TEST_V1997 = - new File(DIR_TEST_DATA, "V1997" + File.separator + - Basename.TEST + "V1997.mdb"); + public final File getFile() { return dbFile; } + + public final Database.FileFormat getExpectedFileFormat() { + return expectedFileFormat; + } + + public final JetFormat getExpectedFormat() { + return expectedFileFormat.getJetFormat(); + } - static final List SUPPORTED_DBS_TEST = - TestDB.getSupportedForBasename(Basename.TEST); + @Override + public final String toString() { + return "dbFile: " + dbFile.getAbsolutePath() + + "; expectedFileFormat: " + expectedFileFormat; + } + public static List getSupportedForBasename(Basename basename) { - public void testGetFormat() throws Exception { - try { - JetFormat.getFormat(null); - fail("npe"); - } catch (NullPointerException e) { - // success - } + List supportedTestDBs = new ArrayList(); + for (Database.FileFormat fileFormat : SUPPORTED_FILEFORMATS) { + supportedTestDBs.add(new TestDB( + getFileForBasename(basename, fileFormat), + fileFormat)); + } + return supportedTestDBs; + } - checkUnsupportedJetFormat(UNSUPPORTED_TEST_V1997); + private static File getFileForBasename( + Basename basename, Database.FileFormat fileFormat) { - for (final TestDB testDB : SUPPORTED_DBS_TEST) { - checkJetFormat(testDB); - } + return new File(DIR_TEST_DATA, + fileFormat.name() + File.separator + + basename + fileFormat.name() + + fileFormat.getFileExtension()); } + } + + private static final File UNSUPPORTED_TEST_V1997 = + new File(DIR_TEST_DATA, "V1997" + File.separator + + Basename.TEST + "V1997.mdb"); - private static void checkJetFormat(final TestDB testDB) - throws IOException { + static final List SUPPORTED_DBS_TEST = + TestDB.getSupportedForBasename(Basename.TEST); - final FileChannel channel = Database.openChannel(testDB.dbFile, false); - try { - JetFormat fmtActual = JetFormat.getFormat(channel); - assertEquals("Unexpected JetFormat for dbFile: " + - testDB.dbFile.getAbsolutePath(), - testDB.expectedFileFormat.getJetFormat(), fmtActual); + public void testGetFormat() throws Exception { + try { + JetFormat.getFormat(null); + fail("npe"); + } catch (NullPointerException e) { + // success + } + + checkUnsupportedJetFormat(UNSUPPORTED_TEST_V1997); - } finally { - channel.close(); - } + for (final TestDB testDB : SUPPORTED_DBS_TEST) { + checkJetFormat(testDB); } + } - private static void checkUnsupportedJetFormat(File testDB) - throws IOException { - - final FileChannel channel = Database.openChannel(testDB, false); - try { - JetFormat.getFormat(channel); - fail("Unexpected JetFormat for dbFile: " + - testDB.getAbsolutePath()); - } catch(IOException ignored) { - // success - } finally { - channel.close(); - } + private static void checkJetFormat(final TestDB testDB) + throws IOException { + + final FileChannel channel = Database.openChannel(testDB.dbFile, false); + try { + + JetFormat fmtActual = JetFormat.getFormat(channel); + assertEquals("Unexpected JetFormat for dbFile: " + + testDB.dbFile.getAbsolutePath(), + testDB.expectedFileFormat.getJetFormat(), fmtActual); + + } finally { + channel.close(); + } + } + + private static void checkUnsupportedJetFormat(File testDB) + throws IOException { + + final FileChannel channel = Database.openChannel(testDB, false); + try { + JetFormat.getFormat(channel); + fail("Unexpected JetFormat for dbFile: " + + testDB.getAbsolutePath()); + } catch(IOException ignored) { + // success + } finally { + channel.close(); } + } }