Skip to content

Commit 19d90d5

Browse files
committed
Fix Test failing because of TimeZone
1 parent 8439650 commit 19d90d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/java/pmedit/SerDesTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33

44
import org.junit.jupiter.api.Test;
5+
import org.junitpioneer.jupiter.DefaultTimeZone;
56
import pmedit.serdes.SerDeslUtils;
67

78
import java.util.*;
89

910
import static org.junit.jupiter.api.Assertions.*;
1011

12+
@DefaultTimeZone("UTC")
1113
public class SerDesTest {
1214
static final String ALL_NULLS_YAML =
1315
"""
@@ -157,7 +159,7 @@ public void testToYaml() {
157159
md.doc.creationDate = new GregorianCalendar(2020,2, 2, 1, 1, 1);
158160
String expected = ALL_NULLS_YAML
159161
.replace("doc.author: null", "doc.author: \"AUTHOR\"")
160-
.replace("doc.creationDate: null", "doc.creationDate: \"2020-03-01T23:01:01.000+00:00\"");
162+
.replace("doc.creationDate: null", "doc.creationDate: \"2020-03-02T01:01:01.000+00:00\"");
161163
assertEquals(expected, md.toYAML());;
162164
}
163165

@@ -168,7 +170,7 @@ public void testFromYaml() {
168170
md.doc.creationDate = new GregorianCalendar(2020,2, 2, 1, 1, 1);
169171
String yaml = ALL_NULLS_YAML
170172
.replace("doc.author: null", "doc.author: \"AUTHOR\"")
171-
.replace("doc.creationDate: null", "doc.creationDate: \"2020-03-01T23:01:01.000+00:00\"");
173+
.replace("doc.creationDate: null", "doc.creationDate: \"2020-03-02T01:01:01.000+00:00\"");
172174
MetadataInfo parsed = new MetadataInfo();
173175
parsed.fromYAML(yaml);;
174176
assertTrue(md.isEquivalent(parsed));
@@ -182,7 +184,7 @@ public void testToJson() {
182184
md.doc.creationDate = new GregorianCalendar(2020,2, 2, 1, 1, 1);
183185
String expected = ALL_NULLS_JSON
184186
.replace("\"doc.author\" : null", "\"doc.author\" : \"AUTHOR\"")
185-
.replace("\"doc.creationDate\" : null", "\"doc.creationDate\" : \"2020-03-01T23:01:01.000+00:00\"");
187+
.replace("\"doc.creationDate\" : null", "\"doc.creationDate\" : \"2020-03-02T01:01:01.000+00:00\"");
186188
assertEquals(expected.trim(), md.toJson().trim());;
187189
}
188190

@@ -193,7 +195,7 @@ public void testFromJson() {
193195
md.doc.creationDate = new GregorianCalendar(2020,2, 2, 1, 1, 1);
194196
String json = ALL_NULLS_JSON
195197
.replace("\"doc.author\" : null", "\"doc.author\" : \"AUTHOR\"")
196-
.replace("\"doc.creationDate\" : null", "\"doc.creationDate\" : \"2020-03-01T23:01:01.000+00:00\"");
198+
.replace("\"doc.creationDate\" : null", "\"doc.creationDate\" : \"2020-03-02T01:01:01.000+00:00\"");
197199
MetadataInfo parsed = new MetadataInfo();
198200
parsed.fromJson(json);;
199201
assertTrue(md.isEquivalent(parsed));

0 commit comments

Comments
 (0)