|
@@ -95,17 +95,20 @@ public class DateProcessorFactoryTests extends ESTestCase {
|
|
|
}
|
|
|
|
|
|
public void testParseInvalidLocale() throws Exception {
|
|
|
- DateProcessor.Factory factory = new DateProcessor.Factory();
|
|
|
- Map<String, Object> config = new HashMap<>();
|
|
|
- String sourceField = randomAlphaOfLengthBetween(1, 10);
|
|
|
- config.put("field", sourceField);
|
|
|
- config.put("formats", Collections.singletonList("dd/MM/yyyyy"));
|
|
|
- config.put("locale", "invalid_locale");
|
|
|
- try {
|
|
|
- factory.create(null, null, config);
|
|
|
- fail("should fail with invalid locale");
|
|
|
- } catch (IllegalArgumentException e) {
|
|
|
- assertThat(e.getMessage(), equalTo("Invalid language tag specified: invalid_locale"));
|
|
|
+ String[] locales = new String[] { "invalid_locale", "english" };
|
|
|
+ for (String locale : locales) {
|
|
|
+ DateProcessor.Factory factory = new DateProcessor.Factory();
|
|
|
+ Map<String, Object> config = new HashMap<>();
|
|
|
+ String sourceField = randomAlphaOfLengthBetween(1, 10);
|
|
|
+ config.put("field", sourceField);
|
|
|
+ config.put("formats", Collections.singletonList("dd/MM/yyyyy"));
|
|
|
+ config.put("locale", locale);
|
|
|
+ try {
|
|
|
+ factory.create(null, null, config);
|
|
|
+ fail("should fail with invalid locale");
|
|
|
+ } catch(IllegalArgumentException e) {
|
|
|
+ assertThat(e.getMessage(), equalTo("Invalid language tag specified: " + locale));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|