summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-19 05:35:26 (EDT)
committerCarsten Drossel2008-08-19 05:35:26 (EDT)
commit20f8dd60f4d1d0cc40b30f84a65281b5d5ca619d (patch)
tree4ad6e93de4d8ce389e34d22ad0171e3d8938e8c9
parent3c1ee8c258aba5735648ffb421a7a87009f82b8c (diff)
downloadorg.eclipse.riena-20f8dd60f4d1d0cc40b30f84a65281b5d5ca619d.zip
org.eclipse.riena-20f8dd60f4d1d0cc40b30f84a65281b5d5ca619d.tar.gz
org.eclipse.riena-20f8dd60f4d1d0cc40b30f84a65281b5d5ca619d.tar.bz2
checking if Arab Locale is available before running tests that depend on it
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/tests/TestUtils.java30
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java8
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java9
3 files changed, 47 insertions, 0 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/tests/TestUtils.java b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/TestUtils.java
new file mode 100644
index 0000000..e6db5c3
--- /dev/null
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/TestUtils.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.tests;
+
+import java.util.Locale;
+
+/**
+ * Utility class for tests.
+ */
+public class TestUtils {
+
+ public static boolean isArabLocaleAvailable() {
+ Locale arabLocale = new Locale("ar", "AE");
+ for (Locale availableLocale : Locale.getAvailableLocales()) {
+ if (availableLocale.equals(arabLocale)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
index 99292e2..725c50a 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
@@ -15,6 +15,7 @@ import java.util.Locale;
import junit.framework.TestCase;
+import org.eclipse.riena.tests.TestUtils;
import org.eclipse.riena.ui.ridgets.validation.MaxNumberLength;
import org.eclipse.riena.ui.ridgets.validation.ValidationFailure;
@@ -142,6 +143,13 @@ public class MaxNumberLengthTest extends TestCase {
// locale has a comma as grouping-separator character and
// features a trailing minus instead of a leading one
+ if (!TestUtils.isArabLocaleAvailable()) {
+ System.err
+ .println(getClass().getName()
+ + ".testArabLocale(): Skipping test because no Arab locale is available. Use international JRE to run all tests.");
+ return;
+ }
+
final MaxNumberLength maxNumberLength = new MaxNumberLength(7, new Locale("ar", "AE"));
try {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
index 1f841c2..f8dc77b 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
@@ -16,6 +16,7 @@ import java.util.Locale;
import junit.framework.TestCase;
+import org.eclipse.riena.tests.TestUtils;
import org.eclipse.riena.ui.ridgets.validation.ValidRange;
/**
@@ -83,6 +84,14 @@ public class ValidRangeTest extends TestCase {
* Handled by JUnit.
*/
public void testRangeArabLocale() throws Exception {
+
+ if (!TestUtils.isArabLocaleAvailable()) {
+ System.err
+ .println(getClass().getName()
+ + ".testRangeArabLocale(): Skipping test because no Arab locale is available. Use international JRE to run all tests.");
+ return;
+ }
+
// Arab locales have a trailing minus
ValidRange rule = new ValidRange(0, 10, new Locale("ar", "AE"));
assertTrue(rule.validate(null).isOK());