You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2021/12/28 07:37:02 UTC
[freemarker] branch FREEMARKER-35 updated: [FREEMARKER-35] Trying to figure out localization related test failure on Travis
This is an automated email from the ASF dual-hosted git repository.
ddekany pushed a commit to branch FREEMARKER-35
in repository https://gitbox.apache.org/repos/asf/freemarker.git
The following commit(s) were added to refs/heads/FREEMARKER-35 by this push:
new b3ac14f [FREEMARKER-35] Trying to figure out localization related test failure on Travis
b3ac14f is described below
commit b3ac14f879c4faa2ebbb99a960bb6f9d9effcba9
Author: ddekany <dd...@apache.org>
AuthorDate: Tue Dec 28 08:36:43 2021 +0100
[FREEMARKER-35] Trying to figure out localization related test failure on Travis
---
.../utility/DateUtilsPatternParsingTest.java | 43 ++++++++++++++++------
1 file changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java b/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
index a010f9f..b92bea4 100644
--- a/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
+++ b/src/test/java/freemarker/template/utility/DateUtilsPatternParsingTest.java
@@ -32,13 +32,17 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.Temporal;
import java.util.Date;
+import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
+import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.hamcrest.Matchers;
import org.junit.Test;
+import com.google.common.collect.ImmutableList;
+
/**
* Move pattern parsing related tests from {@link DateUtilTest} to here.
*/
@@ -61,18 +65,33 @@ public class DateUtilsPatternParsingTest {
// Most likely supported on different test systems
private static final Locale SAMPLE_LOCALE = Locale.US;
- private static final Locale[] SAMPLE_LOCALES = new Locale[] {
- // Locales picked more or less arbitrarily, in alphabetical order
- Locale.CHINA,
- new Locale("ar", "EG"),
- new Locale("fi", "FI"),
- Locale.GERMAN,
- new Locale("hi", "IN"),
- Locale.JAPANESE,
- new Locale("ru", "RU"),
- Locale.US,
- new Locale("th", "TH") // Uses buddhist calendar
- };
+ private static final List<Locale> SAMPLE_LOCALES;
+ static {
+ LocalDate localDate = LocalDate.of(2021, 12, 1);
+ SAMPLE_LOCALES = ImmutableList.of(
+ // Locales picked more or less arbitrarily, in alphabetical order
+ Locale.CHINA,
+ new Locale("ar", "AE"),
+ new Locale("fi", "FI"),
+ Locale.GERMAN,
+ new Locale("hi", "IN"),
+ Locale.JAPANESE,
+ new Locale("ru", "RU"),
+ Locale.US,
+ new Locale("th", "TH") // Uses buddhist calendar
+ ).stream()
+ .filter(locale -> !DateTimeFormatter.ofPattern("MMM", locale).format(localDate).equals("12"))
+ .collect(Collectors.toList());
+ System.out.println("!!T Sample locales: " + SAMPLE_LOCALES); // TODO Remove this
+ }
+
+ @Test
+ public void testHasEnoughSampleLocales() {
+ if (SAMPLE_LOCALES.size() < 3) {
+ throw new AssertionError("Too many locales were filtered out from SAMPLE_LOCALE. " +
+ "We only have these left: " + SAMPLE_LOCALES);
+ }
+ }
@Test
public void testBasics() {