Skip to content

Commit

Permalink
Adjust unit test for ISO8601 dates to Java 23.
Browse files Browse the repository at this point in the history
  • Loading branch information
joehni committed Oct 22, 2024
1 parent 4adc90f commit 5824ae0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004, 2005 Joe Walnes.
* Copyright (C) 2006, 2007, 2018 XStream Committers.
* Copyright (C) 2006, 2007, 2018, 2024 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
Expand All @@ -16,6 +16,7 @@
import java.util.Calendar;
import java.util.Date;

import com.thoughtworks.xstream.core.JVM;
import com.thoughtworks.xstream.testutil.TimeZoneChanger;

import junit.framework.TestCase;
Expand All @@ -30,7 +31,7 @@ protected void setUp() throws Exception {
super.setUp();
converter = new ISO8601DateConverter();

// Ensure that this test always run as if it were in the EST timezone.
// Ensure that this test always run as if it were in the EST (Eastern Standard) timezone (UTC-05:00).
// This prevents failures when running the tests in different zones.
// Note: 'EST' has no relevance - it was just a randomly chosen zone.
TimeZoneChanger.change("EST");
Expand Down Expand Up @@ -64,7 +65,7 @@ public void testUnmarshallsISOFormatInUTC() throws ParseException {
final Date out = (Date)converter.fromString(isoFormat);
final Date control = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(simpleFormat);
// verify for EST
assertEquals("Sun Feb 14 13:10:30 EST 1993", out.toString());
assertEquals("Sun Feb 14 13:10:30 " + (JVM.isVersion(23) ? "GMT-05:00" : "EST") + " 1993", out.toString());
assertEquals(control, out);
}

Expand Down

0 comments on commit 5824ae0

Please sign in to comment.