diff options
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java index e3df4a885..5edae24c5 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/util/LatinTextProcessorTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 2022 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -13,41 +13,47 @@ *******************************************************************************/ package org.eclipse.osgi.tests.util; +import junit.framework.Test; import org.eclipse.osgi.util.TextProcessor; /** - * Test for strings that use the TextProcessor but are not run in a bidi locale. + * Test for strings that use the TextProcessor but are not run in a bidi locale. * Latin locales should return the same String that was passed in. * */ public class LatinTextProcessorTestCase extends TextProcessorTestCase { + + public static Test suite() { + return new TextProcessorSessionTest("org.eclipse.osgi.tests", LatinTextProcessorTestCase.class, "en"); + } + protected static String[] ALL_PATHS; static { // merge all test strings into one array for Latin locales int size = TEST_DEFAULT_PATHS.length + TEST_STAR_PATHS.length + TEST_EQUALS_PATHS.length + TEST_ADDITIONAL_STRINGS.length; ALL_PATHS = new String[size]; int idx = 0; - for (int i = 0; i < TEST_DEFAULT_PATHS.length; i++) { - ALL_PATHS[idx] = TEST_DEFAULT_PATHS[i]; + for (String testDefaultPath : TEST_DEFAULT_PATHS) { + ALL_PATHS[idx] = testDefaultPath; idx++; } - for (int i = 0; i < TEST_STAR_PATHS.length; i++) { - ALL_PATHS[idx] = TEST_STAR_PATHS[i]; + for (String testStartPath : TEST_STAR_PATHS) { + ALL_PATHS[idx] = testStartPath; idx++; } - for (int i = 0; i < TEST_EQUALS_PATHS.length; i++) { - ALL_PATHS[idx] = TEST_EQUALS_PATHS[i]; + for (String testEqualsPath : TEST_EQUALS_PATHS) { + ALL_PATHS[idx] = testEqualsPath; idx++; } - for (int i = 0; i < TEST_ADDITIONAL_STRINGS.length; i++) { - ALL_PATHS[idx] = TEST_ADDITIONAL_STRINGS[i]; + for (String testAdditionalString : TEST_ADDITIONAL_STRINGS) { + ALL_PATHS[idx] = testAdditionalString; idx++; } } /** * Constructor for class. - * + * * @param name test name */ public LatinTextProcessorTestCase(String name) { @@ -61,14 +67,14 @@ public class LatinTextProcessorTestCase extends TextProcessorTestCase { verifyResult("Process string " + (i + 1), result, ALL_PATHS[i]); } } - + public void testLatinPathsDeprocess(){ // test all strings using process(String) method for (int i = 0; i < ALL_PATHS.length; i++) { String result = TextProcessor.process(ALL_PATHS[i]); String resultDP = TextProcessor.deprocess(result); verifyResult("Deprocess string " + (i + 1), resultDP, ALL_PATHS[i]); - } + } } public void testLatinPathsWithNullDelimiter() { @@ -78,7 +84,7 @@ public class LatinTextProcessorTestCase extends TextProcessorTestCase { verifyResult("Process string " + (i + 1), result, ALL_PATHS[i]); } } - + public void testLatinOtherStrings() { // test the process(String, String) method for (int i = 0; i < TEST_STAR_PATHS.length; i++) { @@ -91,7 +97,7 @@ public class LatinTextProcessorTestCase extends TextProcessorTestCase { verifyResult("Equals expression " + (i + 1), result, TEST_EQUALS_PATHS[i]); } } - + public void testLatinOtherStringsDeprocess() { // test the process(String, String) method for (int i = 0; i < TEST_STAR_PATHS.length; i++) { @@ -105,7 +111,7 @@ public class LatinTextProcessorTestCase extends TextProcessorTestCase { String resultDP = TextProcessor.deprocess(result); verifyResult("Equals expression " + (i + 1), resultDP, TEST_EQUALS_PATHS[i]); } - } + } public void testLatinOtherStringsWithNoDelimiter() { for (int i = 0; i < TEST_STAR_PATHS.length; i++) { @@ -123,17 +129,17 @@ public class LatinTextProcessorTestCase extends TextProcessorTestCase { verifyResult("TextProcessor.process(String) for empty string ", TextProcessor.process(""), EMPTY_STRING); verifyResult("TextProcessor.process(String, String) for empty strings ", TextProcessor.process("", ""), EMPTY_STRING); } - + public void testEmptyStringParamsDeprocess() { verifyResult("TextProcessor.deprocess(String) for empty string ", TextProcessor.deprocess(""), EMPTY_STRING); } - + public void testNullParams() { assertNull("TextProcessor.process(String) for null param ", TextProcessor.process(null)); assertNull("TextProcessor.process(String, String) for params ", TextProcessor.process(null, null)); } - + public void testNullParamsDeprocess() { assertNull("TextProcessor.deprocess(String) for null param ", TextProcessor.deprocess(null)); - } + } } |