summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2011-02-27 18:40:20 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2011-02-27 18:40:20 +0000
commitf32d67c43250ec993267f9dfbc833fefc26eb5c0 (patch)
tree314bc2aa0545924c75313b142160c2e6e66493d6 /test
parent0f7f2b12b4d01615e079133356a7d390b78cb9ec (diff)
downloadjackcess-f32d67c43250ec993267f9dfbc833fefc26eb5c0.tar.gz
jackcess-f32d67c43250ec993267f9dfbc833fefc26eb5c0.zip
really fix timezone issue in ExportTest (fixes #3194251)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@514 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/ExportTest.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/ExportTest.java b/test/src/java/com/healthmarketscience/jackcess/ExportTest.java
index 4ffea19..ef0fa23 100644
--- a/test/src/java/com/healthmarketscience/jackcess/ExportTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/ExportTest.java
@@ -35,6 +35,7 @@ import java.util.TimeZone;
import junit.framework.TestCase;
import org.apache.commons.lang.SystemUtils;
+import java.util.Date;
import static com.healthmarketscience.jackcess.Database.*;
import static com.healthmarketscience.jackcess.DatabaseTest.*;
@@ -54,10 +55,11 @@ public class ExportTest extends TestCase
public void testExportToFile() throws Exception
{
- DateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
-
TimeZone testTZ = TimeZone.getTimeZone("America/New_York");
+ DateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
+ df.setTimeZone(testTZ);
+
for (final FileFormat fileFormat : JetFormatTest.SUPPORTED_FILEFORMATS) {
Database db = create(fileFormat);
db.setTimeZone(testTZ);
@@ -71,7 +73,9 @@ public class ExportTest extends TestCase
.addColumn(new ColumnBuilder("col6", DataType.SHORT_DATE_TIME))
.toTable(db);
- t.addRow("some text||some more", 13, 13.25, createString(30).getBytes(), true, df.parse("19801231 00:00:00"));
+ Date testDate = df.parse("19801231 00:00:00");
+ t.addRow("some text||some more", 13, 13.25, createString(30).getBytes(),
+ true, testDate);
t.addRow("crazy'data\"here", -345, -0.000345, createString(7).getBytes(),
true, null);
@@ -84,7 +88,7 @@ public class ExportTest extends TestCase
String expected =
"some text||some more,13,13.25,\"61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78" + NL +
- "79 7A 61 62 63 64\",true,Wed Dec 31 00:00:00 EST 1980" + NL +
+ "79 7A 61 62 63 64\",true," + testDate + NL +
"\"crazy'data\"\"here\",-345,-3.45E-4,61 62 63 64 65 66 67,true," + NL +
"C:\\temp\\some_file.txt,25,0.0,,false," + NL;
@@ -98,7 +102,7 @@ public class ExportTest extends TestCase
expected =
"col1||col2||col3||col4||col5||col6" + NL +
"'some text||some more'||13||13.25||'61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78" + NL +
- "79 7A 61 62 63 64'||true||Wed Dec 31 00:00:00 EST 1980" + NL +
+ "79 7A 61 62 63 64'||true||" + testDate + NL +
"'crazy''data\"here'||-345||-3.45E-4||61 62 63 64 65 66 67||true||" + NL +
"C:\\temp\\some_file.txt||25||0.0||||false||" + NL;
assertEquals(expected, out.toString());