Improvement of the test. Now it examines all the available locale
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/71d69dfd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/71d69dfd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/71d69dfd Branch: refs/heads/master Commit: 71d69dfd3a7e3da68de0e619009590ddec2c0a3a Parents: 9743c50 Author: ancosen <[email protected]> Authored: Sun Jul 6 15:29:05 2014 +0200 Committer: ancosen <[email protected]> Committed: Sun Jul 6 15:29:05 2014 +0200 ---------------------------------------------------------------------- .../bindy/csv/BindyPatternLocaleTest.java | 46 +++++++------------- 1 file changed, 15 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/71d69dfd/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPatternLocaleTest.java ---------------------------------------------------------------------- diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPatternLocaleTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPatternLocaleTest.java index 58bbe24..ac098b2 100644 --- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPatternLocaleTest.java +++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPatternLocaleTest.java @@ -16,8 +16,9 @@ */ package org.apache.camel.dataformat.bindy.csv; -import java.util.Arrays; +import java.text.DateFormat; import java.util.Collection; +import java.util.HashSet; import java.util.Locale; import org.apache.camel.builder.AdviceWithRouteBuilder; @@ -31,42 +32,26 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; /** - * @version + * @version */ @RunWith(Parameterized.class) public class BindyPatternLocaleTest extends CamelTestSupport { - + private String locale; - + public BindyPatternLocaleTest(String locale) { - this.locale = locale; - } + this.locale = locale; + } @Parameters public static Collection<String[]> localeList() { - return Arrays.asList(new String[][] { - {Locale.CANADA.getCountry()}, - {Locale.CANADA_FRENCH.getCountry()}, - {Locale.CHINA.getCountry()}, - {Locale.CHINESE.getLanguage()}, - {Locale.ENGLISH.getLanguage()}, - {Locale.FRANCE.getCountry()}, - {Locale.FRENCH.getLanguage()}, - {Locale.GERMAN.getLanguage()}, - {Locale.GERMANY.getCountry()}, - {Locale.ITALIAN.getLanguage()}, - {Locale.ITALY.getCountry()}, - {Locale.JAPAN.getCountry()}, - {Locale.JAPANESE.getLanguage()}, - {Locale.KOREA.getCountry()}, - {Locale.KOREAN.getLanguage()}, - {Locale.PRC.getCountry()}, - {Locale.SIMPLIFIED_CHINESE.getLanguage()}, - {Locale.TAIWAN.getCountry()}, - {Locale.TRADITIONAL_CHINESE.getLanguage()}, - {Locale.UK.getCountry()}, - {Locale.US.getCountry()}, - }); + Locale list[] = DateFormat.getAvailableLocales(); + Collection<String[]> collection = new HashSet<String[]>(); + for (Locale aLocale : list) { + String[] localeLanguage = { aLocale.getLanguage() }; + collection.add(localeLanguage); + } + return collection; } @Test @@ -78,8 +63,7 @@ public class BindyPatternLocaleTest extends CamelTestSupport { BindyCsvDataFormat bindy = new BindyCsvDataFormat( Unity.class); - // As recommended, when we use @Datafield Pattern we - // must specify the default locale + // Injection of one of the available locale bindy.setLocale(locale); // weave the node in the route which has id = marshaller
