Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160039

LocalDateTimeStringConverterTest fails when default locale is different to en_US

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      other

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The LocalDateTimeStringConverterTests expect that the default locale is en_US. When executing them on a machine with default locale de_DE, the tests fail as follows:

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_parser[0] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_parser(LocalDateTimeStringConverterTest.java:144)

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_null_parser[0] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_null_parser(LocalDateTimeStringConverterTest.java:152)

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_parser[1] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_parser(LocalDateTimeStringConverterTest.java:144)

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_null_parser[1] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_null_parser(LocalDateTimeStringConverterTest.java:152)

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_parser[2] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_parser(LocalDateTimeStringConverterTest.java:144)

      test.javafx.util.converter.LocalDateTimeStringConverterTest > converter_with_specified_formatter_and_null_parser[2] FAILED
         org.junit.ComparisonFailure: expected:<12 Januar[y] 1985, 12:34:56> but was:<12 Januar[] 1985, 12:34:56>
             at org.junit.Assert.assertEquals(Assert.java:123)
             at org.junit.Assert.assertEquals(Assert.java:145)
             at test.javafx.util.converter.LocalDateTimeStringConverterTest.converter_with_specified_formatter_and_null_parser(LocalDateTimeStringConverterTest.java:152)

      This can be fixed by adding an appropriate setup step that initialized the default locale to en_US as follows:

      @BeforeClass
      public static void initDefaultLocale(){
        // tests require that default locale is English
        Locale.setDefault(Locale.ENGLISH);
      }


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: