Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests with java 11 #1432

Closed
fridrich opened this issue Nov 21, 2018 · 4 comments
Closed

Fix tests with java 11 #1432

fridrich opened this issue Nov 21, 2018 · 4 comments

Comments

@fridrich
Copy link

Java 11 changed the name of UTC timezone for DateTime.FULL in Locale.FRANCE, and thus the tests fail.
This is the fix:

--- gson-gson-parent-2.8.5/gson/src/test/java/com/google/gson/DefaultDateTypeAdapterTest.java	2018-11-21 09:00:13.758469543 +0100
+++ gson-gson-parent-2.8.5/gson/src/test/java/com/google/gson/DefaultDateTypeAdapterTest.java	2018-11-21 10:27:42.149213110 +0100
@@ -88,8 +88,9 @@
           new DefaultDateTypeAdapter(DateFormat.MEDIUM, DateFormat.MEDIUM));
       assertParsed(String.format("1 janvier 1970%s00:00:00 UTC", afterYearSep),
           new DefaultDateTypeAdapter(DateFormat.LONG, DateFormat.LONG));
-      assertParsed(JavaVersion.isJava9OrLater() ?
+      assertParsed(JavaVersion.isJava9OrLater() ? (JavaVersion.getMajorJavaVersion() < 11 ?
                       "jeudi 1 janvier 1970 à 00:00:00 Coordinated Universal Time" :
+                      "jeudi 1 janvier 1970 à 00:00:00 Temps universel coordonné") :
                       "jeudi 1 janvier 1970 00 h 00 UTC",
           new DefaultDateTypeAdapter(DateFormat.FULL, DateFormat.FULL));
     } finally {
@fridrich
Copy link
Author

Rather:

--- gson-gson-parent-2.8.5/gson/src/test/java/com/google/gson/DefaultDateTypeAdapterTest.java	2018-11-21 09:00:13.758469543 +0100
+++ gson-gson-parent-2.8.5/gson/src/test/java/com/google/gson/DefaultDateTypeAdapterTest.java	2018-11-21 10:27:42.149213110 +0100
@@ -88,8 +88,9 @@
           new DefaultDateTypeAdapter(DateFormat.MEDIUM, DateFormat.MEDIUM));
       assertParsed(String.format("1 janvier 1970%s00:00:00 UTC", afterYearSep),
           new DefaultDateTypeAdapter(DateFormat.LONG, DateFormat.LONG));
-      assertParsed(JavaVersion.isJava9OrLater() ?
+      assertParsed(JavaVersion.isJava9OrLater() ? (JavaVersion.getMajorJavaVersion() < 11 ?
                       "jeudi 1 janvier 1970 à 00:00:00 Coordinated Universal Time" :
+                      "jeudi 1 janvier 1970 à 00:00:00 Temps universel coordonné") :
                       "jeudi 1 janvier 1970 00 h 00 UTC",
           new DefaultDateTypeAdapter(DateFormat.FULL, DateFormat.FULL));
     } finally {

In a proper UTF-8

@paulkass
Copy link
Contributor

Hmm can you considered opening a PR?

@Marcono1234
Copy link
Collaborator

This can probably be closed now since this was fixed by #1454, right?

@eamonnmcmanus
Copy link
Member

Yes. What's more our CI uses Java 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants