8058514: TEST_BUG: New tests introduced in 8058429 are TimeZone dependent
Reviewed-by: lancea
--- a/jdk/test/java/sql/test/sql/TimestampTests.java Mon Sep 15 21:20:46 2014 +0200
+++ b/jdk/test/java/sql/test/sql/TimestampTests.java Tue Sep 16 00:26:58 2014 +0200
@@ -29,13 +29,38 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
+import java.util.TimeZone;
import static org.testng.Assert.*;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import util.BaseTest;
public class TimestampTests extends BaseTest {
+ private static TimeZone defaultTimeZone = null;
+
+ /*
+ * Need to set and use a custom TimeZone which does not
+ * observe daylight savings time for this test.
+ */
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ defaultTimeZone = TimeZone.getDefault();
+ TimeZone tzone = TimeZone.getTimeZone("GMT+01");
+ assertFalse(tzone.observesDaylightTime());
+ TimeZone.setDefault(tzone);
+ }
+
+ /*
+ * Conservatively reset the default time zone after test.
+ */
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+
/*
* Validate an IllegalArgumentException is thrown for an invalid Timestamp
*/