Skip to content

Commit

Permalink
Use constant for src/test/data/
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Feb 21, 2024
1 parent 8b5b13b commit 5088cbc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/test/java/io/github/spannm/jackcess/LinkedTableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ void testLinkedTables() throws Exception {

assertTrue(db.getLinkedDatabases().isEmpty());

final String linkeeDbName = "Z:\\jackcess_test\\linkeeTest.accdb";
final File linkeeFile = new File("src/test/data/linkeeTest.accdb");
String linkeeDbName = "Z:\\jackcess_test\\linkeeTest.accdb";
File linkeeFile = new File(DIR_TEST_DATA, "linkeeTest.accdb");
db.setLinkResolver((linkerdb, dbName) -> {
assertEquals(linkeeDbName, dbName);
return DatabaseBuilder.open(linkeeFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void testReadLongValue() throws Exception {
assertEquals("Project1", row.get("PROJ_PROP_TITLE"));
byte[] foundBinaryData = row.getBytes("RESERVED_BINARY_DATA");
byte[] expectedBinaryData =
toByteArray(new File("src/test/data/test2BinData.dat"));
toByteArray(new File(DIR_TEST_DATA, "test2BinData.dat"));
assertArrayEquals(expectedBinaryData, foundBinaryData);
}
}
Expand All @@ -74,7 +74,7 @@ void testWriteLongValue(FileFormat fileFormat) throws Exception {

String testStr = "This is a test";
String longMemo = createString(2030);
byte[] oleValue = toByteArray(new File("src/test/data/test2BinData.dat"));
byte[] oleValue = toByteArray(new File(DIR_TEST_DATA, "test2BinData.dat"));

table.addRow(testStr, testStr, null);
table.addRow(testStr, longMemo, oleValue);
Expand Down Expand Up @@ -193,7 +193,7 @@ void testLongValueAsMiddleColumn(FileFormat fileFormat) throws Exception {

@Test
void testUnicodeCompression() throws Exception {
File dbFile = new File("src/test/data/V2003/testUnicodeCompV2003.mdb");
File dbFile = new File(DIR_TEST_DATA, "V2003/testUnicodeCompV2003.mdb");
try (Database db = open(FileFormat.V2003, dbFile, true)) {
StringBuilder sb = new StringBuilder(127);
for (int i = 1; i <= 0xFF; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void testRead(TestDB testDB) throws Exception {
void testGobalReferenceUsageMap() throws Exception {
try (Database db = openCopy(
FileFormat.V2000,
new File("src/test/data/V2000/testRefGlobalV2000.mdb"))) {
new File(DIR_TEST_DATA, "V2000/testRefGlobalV2000.mdb"))) {
Table t = new TableBuilder("Test2")
.addColumn(new ColumnBuilder("id", DataType.LONG))
.addColumn(new ColumnBuilder("data1", DataType.TEXT))
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/io/github/spannm/jackcess/util/ImportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void testImportFromFile(FileFormat fileFormat) throws Exception {
try (Database db = create(fileFormat)) {
String tableName = new ImportUtil.Builder(db, "test")
.withDelimiter("\\t")
.importFile(new File("src/test/data/sample-input.tab"));
.importFile(new File(DIR_TEST_DATA, "sample-input.tab"));
Table t = db.getTable(tableName);

List<String> colNames = new ArrayList<>();
Expand Down Expand Up @@ -90,7 +90,7 @@ void testImportFromFile(FileFormat fileFormat) throws Exception {
.withDelimiter("\\t")
.withUseExistingTable(true)
.withHeader(false)
.importFile(new File("src/test/data/sample-input.tab"));
.importFile(new File(DIR_TEST_DATA, "sample-input.tab"));

expectedRows =
createExpectedTable(
Expand Down Expand Up @@ -136,7 +136,7 @@ public Object[] filterRow(Object[] row) {
tableName = new ImportUtil.Builder(db, "test3")
.withDelimiter("\\t")
.withFilter(oddFilter)
.importFile(new File("src/test/data/sample-input.tab"));
.importFile(new File(DIR_TEST_DATA, "sample-input.tab"));
t = db.getTable(tableName);

colNames = new ArrayList<>();
Expand Down Expand Up @@ -169,7 +169,7 @@ void testImportFromFileWithOnlyHeaders(FileFormat fileFormat) throws Exception {
try (Database db = create(fileFormat)) {
String tableName = new ImportUtil.Builder(db, "test")
.withDelimiter("\\t")
.importFile(new File("src/test/data/sample-input-only-headers.tab"));
.importFile(new File(DIR_TEST_DATA, "sample-input-only-headers.tab"));

Table t = db.getTable(tableName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MemFileChannelTest extends AbstractBaseTest {

@Test
void testReadOnlyChannel() throws Exception {
File testFile = new File("src/test/data/V1997/compIndexTestV1997.mdb");
File testFile = new File(DIR_TEST_DATA, "V1997/compIndexTestV1997.mdb");
MemFileChannel ch = MemFileChannel.newChannel(testFile, "r");
assertEquals(testFile.length(), ch.size());
assertEquals(0L, ch.position());
Expand Down Expand Up @@ -82,7 +82,7 @@ void testChannel() throws Exception {

assertFalse(ch.isOpen());

File testFile = new File("src/test/data/V1997/compIndexTestV1997.mdb");
File testFile = new File(DIR_TEST_DATA, "V1997/compIndexTestV1997.mdb");
ch = MemFileChannel.newChannel(testFile, "r");
assertEquals(testFile.length(), ch.size());
assertEquals(0L, ch.position());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class OleBlobTest extends AbstractBaseTest {
@ParameterizedTest(name = "[{index}] {0}")
@MethodSource("getSupportedFileformats")
void testCreateBlob(FileFormat fileFormat) throws Exception {
File sampleFile = new File("src/test/data/sample-input.tab");
File sampleFile = new File(DIR_TEST_DATA, "sample-input.tab");
String sampleFilePath = sampleFile.getAbsolutePath();
String sampleFileName = sampleFile.getName();
byte[] sampleFileBytes = toByteArray(sampleFile);
Expand Down

0 comments on commit 5088cbc

Please sign in to comment.