summaryrefslogtreecommitdiffstats
path: root/regex/src
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:50:54 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:50:54 -0800
commita0881d052ee72e3f7e773374e9b1aa75fbd6be4c (patch)
tree8a9462436077d0d906368cb21f521f1bf8a25500 /regex/src
parentdd828f42a5c83b4270d4fbf6fce2da1878f1e84a (diff)
downloadlibcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.zip
libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.gz
libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'regex/src')
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/AllTests.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/AllTests.java)10
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Matcher2Test.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java)144
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/MatcherTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java)958
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ModeTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/ModeTest.java)59
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Pattern2Test.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java)321
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternErrorTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java)33
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.java122
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java)1222
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ReplaceTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java)70
-rw-r--r--regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java (renamed from regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java)84
-rw-r--r--regex/src/test/java/tests/regex/AllTests.java4
-rwxr-xr-xregex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser (renamed from regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser)bin1711 -> 1711 bytes
-rwxr-xr-xregex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternTest.golden.ser (renamed from regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternTest.golden.ser)bin94 -> 94 bytes
13 files changed, 1625 insertions, 1402 deletions
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/AllTests.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/AllTests.java
index 6296285..b69c401 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/AllTests.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/AllTests.java
@@ -1,4 +1,4 @@
- /*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -15,14 +15,13 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
- * Test suite for java.util.regex package
- *
+ * Provides a test suite for java.util.regex package.
*/
public class AllTests {
@@ -31,7 +30,7 @@ public class AllTests {
}
public static Test suite() {
- TestSuite suite = new TestSuite("Tests for java.util.regex");
+ TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for java.util.regex");
//$JUnit-BEGIN$
suite.addTestSuite(Matcher2Test.class);
@@ -39,6 +38,7 @@ public class AllTests {
suite.addTestSuite(ModeTest.class);
suite.addTestSuite(Pattern2Test.class);
suite.addTestSuite(PatternErrorTest.class);
+ suite.addTestSuite(PatternSyntaxExceptionTest.class);
suite.addTestSuite(PatternTest.class);
suite.addTestSuite(ReplaceTest.class);
suite.addTestSuite(SplitTest.class);
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Matcher2Test.java
index a15adae..ab0de63 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Matcher2Test.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import junit.framework.TestCase;
@@ -31,12 +31,11 @@ import java.util.regex.*;
@TestTargetClass(java.util.regex.Matcher.class)
public class Matcher2Test extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the basic functionality of toString() method.",
- targets = { @TestTarget(methodName = "toString",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL,
+ notes = "Verifies the basic functionality of toString() method.",
+ method = "toString",
+ args = {}
)
public void test_toString() {
Pattern p = Pattern.compile("foo");
@@ -44,27 +43,50 @@ public class Matcher2Test extends TestCase {
assertNotNull(m.toString());
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies start, end, group, usePattern methods " +
- "with wrong conditions, IllegalStateException should be " +
- "thrown",
- targets = { @TestTarget(methodName = "start",
- methodArgs = {}),
- @TestTarget(methodName = "end",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {}),
- @TestTarget(methodName = "start",
- methodArgs = {int.class}),
- @TestTarget(methodName = "end",
- methodArgs = {int.class}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class}),
- @TestTarget(methodName = "usePattern",
- methodArgs = {java.util.regex.Pattern.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "start",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "end",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "group",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "start",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "end",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "group",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies start, end, group, usePattern methods with wrong conditions, IllegalStateException should be thrown",
+ method = "usePattern",
+ args = {java.util.regex.Pattern.class}
+ )
+ })
public void testErrorConditions() throws PatternSyntaxException {
// Test match cursors in absence of a match
Pattern p = Pattern.compile("foo");
@@ -116,23 +138,38 @@ public class Matcher2Test extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies end, start, group methods with wrong " +
- "conditions, IndexOutOfBoundsException, " +
- "IllegalStateException should be thrown",
- targets = { @TestTarget(methodName = "start",
- methodArgs = {}),
- @TestTarget(methodName = "end",
- methodArgs = {}),
- @TestTarget(methodName = "start",
- methodArgs = {int.class}),
- @TestTarget(methodName = "end",
- methodArgs = {int.class}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies end, start, group methods with wrong conditions, IndexOutOfBoundsException, IllegalStateException should be thrown",
+ method = "start",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies end, start, group methods with wrong conditions, IndexOutOfBoundsException, IllegalStateException should be thrown",
+ method = "end",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies end, start, group methods with wrong conditions, IndexOutOfBoundsException, IllegalStateException should be thrown",
+ method = "start",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies end, start, group methods with wrong conditions, IndexOutOfBoundsException, IllegalStateException should be thrown",
+ method = "end",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies end, start, group methods with wrong conditions, IndexOutOfBoundsException, IllegalStateException should be thrown",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testErrorConditions2() throws PatternSyntaxException {
// Test match cursors in absence of a match
Pattern p = Pattern.compile("(foo[0-9])(bar[a-z])");
@@ -268,14 +305,11 @@ public class Matcher2Test extends TestCase {
/*
* Regression test for HARMONY-997
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies that IndexOutOfBoundsException " +
- "exception is thrown while calling of replaceAll " +
- "method with incorrect string.",
- targets = { @TestTarget(methodName = "replaceAll",
- methodArgs = { java.lang.String.class } )
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies that IndexOutOfBoundsException exception is thrown while calling of replaceAll method with incorrect string.",
+ method = "replaceAll",
+ args = {java.lang.String.class}
)
public void testReplacementBackSlash() {
String str = "replace me";
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/MatcherTest.java
index 91da9e4..5e9137b 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/MatcherTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/MatcherTest.java
@@ -15,18 +15,29 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
-import dalvik.annotation.TestLevel;
-
-import junit.framework.TestCase;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-@TestTargetClass(Matcher.class)
+import junit.framework.TestCase;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+@TestTargetClass(
+ value = Matcher.class,
+ untestedMethods= {
+ @TestTargetNew(
+ level = TestLevel.NOT_FEASIBLE,
+ notes = "finalize is hard to test since the implementation only calls a native function",
+ method = "finalize",
+ args = {}
+ )
+ }
+
+)
public class MatcherTest extends TestCase {
String[] testPatterns = {
"(a|b)*abb",
@@ -41,14 +52,11 @@ public class MatcherTest extends TestCase {
String[] groupPatterns = { "(a|b)*aabb", "((a)|b)*aabb", "((a|b)*)a(abb)",
"(((a)|(b))*)aabb", "(((a)|(b))*)aa(b)b", "(((a)|(b))*)a(a(b)b)" };
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies appendReplacement(StringBuffer sb, " +
- "String replacement) method. Doesn't verify exceptions.",
- targets = { @TestTarget(methodName = "appendReplacement",
- methodArgs = { java.lang.StringBuffer.class,
- java.lang.String.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "appendReplacement",
+ args = {java.lang.StringBuffer.class, java.lang.String.class}
)
public void testAppendReplacement() {
Pattern pat = Pattern.compile("XX");
@@ -60,16 +68,33 @@ public class MatcherTest extends TestCase {
}
m.appendTail(sb);
assertEquals("Today is 0-11-22 ...", sb.toString());
+
+ pat = Pattern.compile("cat");
+ m = pat.matcher("one-cat-two-cats-in-the-yard");
+ sb = new StringBuffer();
+ Throwable t = null;
+ m.find();
+ try {
+ m.appendReplacement(null, "dog");
+ } catch (NullPointerException e) {
+ t = e;
+ }
+ assertNotNull(t);
+ t = null;
+ m.find();
+ try {
+ m.appendReplacement(sb, null);
+ } catch (NullPointerException e) {
+ t = e;
+ }
+ assertNotNull(t);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies appendReplacement(StringBuffer sb, " +
- "String replacement) method. Doesn\'t verify exceptions.",
- targets = { @TestTarget(methodName = "appendReplacement",
- methodArgs = { java.lang.StringBuffer.class,
- java.lang.String.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "appendReplacement",
+ args = {java.lang.StringBuffer.class, java.lang.String.class}
)
public void testAppendReplacementRef() {
Pattern p = Pattern.compile("xx (rur|\\$)");
@@ -83,12 +108,11 @@ public class MatcherTest extends TestCase {
assertEquals("1 $ equals to 30 rur.", sb.toString());
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies replaceAll(String replacement) method.",
- targets = { @TestTarget(methodName = "replaceAll",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "replaceAll",
+ args = {java.lang.String.class}
)
public void testReplaceAll() {
String input = "aabfooaabfooabfoob";
@@ -103,12 +127,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#reset(String)
* test reset(String) method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the reset(CharSequence input) method.",
- targets = { @TestTarget(methodName = "reset",
- methodArgs = {java.lang.CharSequence.class})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the reset(CharSequence input) method.",
+ method = "reset",
+ args = {java.lang.CharSequence.class}
)
public void test_resetLjava_lang_String() {
String testPattern = "(abb)";
@@ -124,15 +147,11 @@ public class MatcherTest extends TestCase {
assertTrue("After reset matcher should find pattern in given input", mat.find());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies appendReplacement(StringBuffer sb, " +
- "String replacement) method with string of slashes as a parameter." +
- "Doesn't verify exceptions.",
- targets = { @TestTarget(methodName = "appendReplacement",
- methodArgs = { java.lang.StringBuffer.class,
- java.lang.String.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "appendReplacement",
+ args = {java.lang.StringBuffer.class, java.lang.String.class}
)
public void testAppendSlashes() {
Pattern p = Pattern.compile("\\\\");
@@ -145,12 +164,53 @@ public class MatcherTest extends TestCase {
assertEquals("one\\cat\\two\\cats\\in\\the\\yard", sb.toString());
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies replaceFirst(String replacement) method. ",
- targets = { @TestTarget(methodName = "replaceFirst",
- methodArgs = {java.lang.String.class})
- }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "appendTail",
+ args = {java.lang.StringBuffer.class}
+ )
+ public void testAppendTail() {
+ Pattern p = Pattern.compile("cat");
+ Matcher m = p.matcher("one-cat-two-cats-in-the-yard");
+ StringBuffer sb = new StringBuffer();
+ while (m.find()) {
+ m.appendReplacement(sb, "dog");
+ }
+ m.appendTail(sb);
+ assertEquals("one-dog-two-dogs-in-the-yard", sb.toString());
+
+ p = Pattern.compile("cat|yard");
+ m = p.matcher("one-cat-two-cats-in-the-yard");
+ sb = new StringBuffer();
+ while (m.find()) {
+ m.appendReplacement(sb, "dog");
+ }
+ assertEquals("one-dog-two-dogs-in-the-dog", sb.toString());
+ m.appendTail(sb);
+ assertEquals("one-dog-two-dogs-in-the-dog", sb.toString());
+
+ p = Pattern.compile("cat");
+ m = p.matcher("one-cat-two-cats-in-the-yard");
+ sb = new StringBuffer();
+ while (m.find()) {
+ m.appendReplacement(sb, "dog");
+ }
+ Throwable t = null;
+ try {
+ m.appendTail(null);
+ } catch (NullPointerException e) {
+ t = e;
+ }
+ assertNotNull(t);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies replaceFirst(String replacement) method. ",
+ method = "replaceFirst",
+ args = {java.lang.String.class}
)
public void testReplaceFirst() {
String input = "zzzdogzzzdogzzz";
@@ -160,12 +220,11 @@ public class MatcherTest extends TestCase {
assertEquals("zzzcatzzzdogzzz", mat.replaceFirst("cat"));
}
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies pattern() method.",
- targets = { @TestTarget(methodName = "pattern",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies pattern() method.",
+ method = "pattern",
+ args = {}
)
public void testPattern() {
for (String element : testPatterns) {
@@ -183,12 +242,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#reset()
* test reset() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the reset() method. ",
- targets = { @TestTarget(methodName = "reset",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the reset() method. ",
+ method = "reset",
+ args = {}
)
public void test_reset() {
String testPattern = "(abb)";
@@ -204,12 +262,11 @@ public class MatcherTest extends TestCase {
/*
* Class under test for String group(int)
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies group(int group) method.",
- targets = { @TestTarget(methodName = "group",
- methodArgs = { int.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies group(int group) method.",
+ method = "group",
+ args = {int.class}
)
public void testGroupint() {
String positiveTestString = "ababababbaaabb";
@@ -254,15 +311,20 @@ public class MatcherTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies group() and group(int group) methods.",
- targets = { @TestTarget(methodName = "group",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies group() and group(int group) methods.",
+ method = "group",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies group() and group(int group) methods.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testGroup() {
String positiveTestString = "ababababbaaabb";
String negativeTestString = "gjhfgdsjfhgcbv";
@@ -289,12 +351,11 @@ public class MatcherTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies group(int group) method.",
- targets = { @TestTarget(methodName = "group",
- methodArgs = { int.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies group(int group) method.",
+ method = "group",
+ args = {int.class}
)
public void testGroupPossessive() {
Pattern pat = Pattern.compile("((a)|(b))++c");
@@ -308,13 +369,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#hasAnchoringBounds()
* test hasAnchoringBounds() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies that hasAnchoringBounds method returns" +
- " correct value.",
- targets = { @TestTarget(methodName = "hasAnchoringBounds",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies that hasAnchoringBounds method returns correct value.",
+ method = "hasAnchoringBounds",
+ args = {}
)
public void test_hasAnchoringBounds() {
String testPattern = "abb";
@@ -338,13 +397,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#hasTransparentBounds()
* test hasTransparentBounds() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies that hasTransparentBound method returns" +
- " correct value.",
- targets = { @TestTarget(methodName = "hasTransparentBounds",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies that hasTransparentBound method returns correct value.",
+ method = "hasTransparentBounds",
+ args = {}
)
public void test_hasTransparentBounds() {
String testPattern = "abb";
@@ -368,12 +425,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#start(int)
* test start(int) method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the start(int group) method.",
- targets = { @TestTarget(methodName = "start",
- methodArgs = {int.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the start(int group) method.",
+ method = "start",
+ args = {int.class}
)
public void test_startI() {
String testPattern = "(((abb)a)(bb))";
@@ -401,12 +457,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#end(int)
* test end(int) method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the basic functionality of end(int group) method.",
- targets = { @TestTarget(methodName = "end",
- methodArgs = {int.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of end(int group) method.",
+ method = "end",
+ args = {int.class}
)
public void test_endI() {
String testPattern = "(((abb)a)(bb))";
@@ -429,12 +484,11 @@ public class MatcherTest extends TestCase {
}
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method in miscellaneous cases.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method in miscellaneous cases.",
+ method = "matches",
+ args = {}
)
public void testMatchesMisc() {
String[][] posSeq = {
@@ -464,12 +518,11 @@ public class MatcherTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Stress test for matches() method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Stress test for matches() method.",
+ method = "matches",
+ args = {}
)
public void testMatchesQuantifiers() {
String[] testPatternsSingles = { "a{5}", "a{2,4}", "a{3,}" };
@@ -510,16 +563,20 @@ public class MatcherTest extends TestCase {
}
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() and group(int group) methods" +
- " for specific pattern.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "matches",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testQuantVsGroup() {
String patternString = "(d{1,3})((a|c)*)(d{1,3})((a|c)*)(d{1,3})";
String testString = "dacaacaacaaddaaacaacaaddd";
@@ -540,13 +597,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#lookingAt()
* test lookingAt() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies that lookingAt() method returns" +
- " correct value.",
- targets = { @TestTarget(methodName = "lookingAt",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies that lookingAt() method returns correct value.",
+ method = "lookingAt",
+ args = {}
)
public void test_lookingAt() {
String testPattern = "(((abb)a)(bb))";
@@ -565,13 +620,11 @@ public class MatcherTest extends TestCase {
/*
* Class under test for boolean find()
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies that find() method returns" +
- " correct value.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies that find() method returns correct value.",
+ method = "find",
+ args = {}
)
public void testFind() {
String testPattern = "(abb)";
@@ -606,13 +659,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#find(int)
* test find (int) method. Created via modifying method for find
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the basic functionality of find(int start) " +
- "method. Doesn't verify IndexOutOfBoundsException.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {int.class})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "find",
+ args = {int.class}
)
public void test_findI() {
String testPattern = "(abb)";
@@ -648,13 +699,26 @@ public class MatcherTest extends TestCase {
assertEquals(testString.substring(i, i + length), mat2.group(1));
}
}
+
+ // Starting index out of region
+ Pattern pat3 = Pattern.compile("new");
+ Matcher mat3 = pat3.matcher("Brave new world");
+
+ assertTrue(mat3.find(-1));
+ assertTrue(mat3.find(6));
+ assertFalse(mat3.find(7));
+
+ mat3.region(7, 10);
+
+ assertFalse(mat3.find(3));
+ assertFalse(mat3.find(6));
+ assertFalse(mat3.find(7));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method for predefined.",
- targets = { @TestTarget(methodName = "replaceFirst",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method for predefined.",
+ method = "replaceFirst",
+ args = {java.lang.String.class}
)
public void testSEOLsymbols() {
Pattern pat = Pattern.compile("^a\\(bb\\[$");
@@ -667,12 +731,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#start()
* test start() method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the start() method.",
- targets = { @TestTarget(methodName = "start",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the start() method.",
+ method = "start",
+ args = {}
)
public void test_start() {
String testPattern = "(abb)";
@@ -697,12 +760,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#end()
* test end() method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the basic functionality of end() method. ",
- targets = { @TestTarget(methodName = "end",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of end() method. ",
+ method = "end",
+ args = {}
)
public void test_end() {
String testPattern = "(abb)";
@@ -722,12 +784,11 @@ public class MatcherTest extends TestCase {
}
}
}
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies groupCount() method.",
- targets = { @TestTarget(methodName = "groupCount",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies groupCount() method.",
+ method = "groupCount",
+ args = {}
)
public void testGroupCount() {
for (int i = 0; i < groupPatterns.length; i++) {
@@ -737,16 +798,62 @@ public class MatcherTest extends TestCase {
assertEquals(i + 1, mat.groupCount());
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() and group(int group) methods" +
- " for specific pattern.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "region",
+ args = {int.class, int.class}
+ )
+ public void testRegion() {
+ Pattern p = Pattern.compile("abba");
+ Matcher m = p.matcher("Gabba gabba hey");
+
+ m.region(0, 15);
+ assertTrue(m.find());
+ assertTrue(m.find());
+ assertFalse(m.find());
+
+ m.region(5, 15);
+ assertTrue(m.find());
+ assertFalse(m.find());
+
+ m.region(10, 15);
+ assertFalse(m.find());
+
+ Throwable t = null;
+
+ try {
+ m.region(-1, 15);
+ } catch (IllegalArgumentException e) {
+ t = e;
+ }
+ assertNotNull(t);
+
+ t = null;
+ try {
+ m.region(0, 16);
+ } catch (IllegalArgumentException e) {
+ t = e;
+ }
+ assertNotNull(t);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "matches",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testRelactantQuantifiers() {
Pattern pat = Pattern.compile("(ab*)*b");
Matcher mat = pat.matcher("abbbb");
@@ -757,12 +864,11 @@ public class MatcherTest extends TestCase {
fail("Match expected: (ab*)*b vs abbbb");
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies find() method.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies find() method.",
+ method = "find",
+ args = {}
)
public void testEnhancedFind() {
String input = "foob";
@@ -774,90 +880,26 @@ public class MatcherTest extends TestCase {
assertEquals("b", mat.group());
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "Verifies matches method for input sequence " +
- "specified by URL.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches method for input sequence specified by URL.",
+ method = "matches",
+ args = {}
)
- public void _testMatchesURI() {
- final Pattern pat = Pattern
- .compile("^(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
- Runnable r1 = new Runnable() {
- public void run() {
- Matcher mat = pat
- .matcher("file:/c:/workspace/api/build.win32/classes/META-INF/"
- + "services/javax.xml.parsers.DocumentBuilderFactory");
- int k1 = 1;
- while (mat.matches()) {
- }// System.err.println("1: " + mat.group());
- System.out.println("1: fail");
- }
- };
-
- Runnable r2 = new Runnable() {
- public void run() {
- Matcher mat = pat.matcher("file:/c:/workspace/"
+ public void testMatchesURI() {
+ Pattern pat = Pattern.
+ compile("^(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
+ Matcher mat = pat
+ .matcher("file:/c:/workspace/api/build.win32/classes/META-INF/"
+ "services/javax.xml.parsers.DocumentBuilderFactory");
- int k1 = 1;
- while (mat.matches()) {
- }// System.err.println("2: " + mat.group());
- System.out.println("2: fail");
- }
- };
-
- Thread t1 = new Thread(r1);
- Thread t2 = new Thread(r2);
-
- t1.start();
- t2.start();
-
- try {
- t1.join();
- t2.join();
- } catch (Exception e) {
- }
-
- }
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "TODO there is no any testing.",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
- )
- public void _testUnifiedQuantifiers() {
- // Pattern pat1 = Pattern.compile("\\s+a");
- Pattern pat2 = Pattern.compile(" *a");
-
- Matcher mat = pat2.matcher(" a");
-
- System.out.println("unified: " + mat.find());
- }
-
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "DOesn't verify anything.",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
- )
- public void _testCompositeGroupQuantifiers() {
- Pattern pat = Pattern.compile("(a|b){0,3}abb");
- Matcher mat = pat.matcher("ababababababababababaab");
-
- System.out.println("composite: " + mat.find());
+ assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method for " +
- "composite pattern groups.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method for composite pattern groups.",
+ method = "matches",
+ args = {}
)
public void testPosCompositeGroup() {
String[] posExamples = { "aabbcc", "aacc", "bbaabbcc" };
@@ -879,12 +921,11 @@ public class MatcherTest extends TestCase {
assertTrue(Pattern.matches("(aa|bb){1,3}+bb", "aabbaabb"));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method for specific patterns.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method for specific patterns.",
+ method = "matches",
+ args = {}
)
public void testPosAltGroup() {
String[] posExamples = { "aacc", "bbcc", "cc" };
@@ -905,16 +946,20 @@ public class MatcherTest extends TestCase {
assertTrue(Pattern.matches("(aa|bb)?+bb", "aabb"));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() and group(int group) methods" +
- " for specific pattern.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "matches",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testRelCompGroup() {
Matcher mat;
@@ -928,16 +973,20 @@ public class MatcherTest extends TestCase {
res += "aa";
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() and group(int group) methods" +
- " for specific pattern.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "matches",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods for specific pattern.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testRelAltGroup() {
Matcher mat;
@@ -954,13 +1003,11 @@ public class MatcherTest extends TestCase {
assertEquals("aa", mat.group(1));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method for case insensitive " +
- "pattern.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method for case insensitive pattern.",
+ method = "matches",
+ args = {}
)
public void testIgnoreCase() {
Pattern pat = Pattern.compile("(aa|bb)*", Pattern.CASE_INSENSITIVE);
@@ -977,27 +1024,30 @@ public class MatcherTest extends TestCase {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies quoteReplacement(String s) method. " +
- "Doesn't check negative cases.",
- targets = { @TestTarget(methodName = "quoteReplacement",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "quoteReplacement",
+ args = {java.lang.String.class}
)
public void testQuoteReplacement() {
- assertEquals("\\\\aaCC\\$1", Matcher.quoteReplacement("\\aaCC$1"));
+ assertEquals("\\$dollar and slash\\\\", Matcher.quoteReplacement("$dollar and slash\\"));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() and group(int group) methods.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {}),
- @TestTarget(methodName = "group",
- methodArgs = {int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods.",
+ method = "matches",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() and group(int group) methods.",
+ method = "group",
+ args = {int.class}
+ )
+ })
public void testOverFlow() {
Pattern tp = Pattern.compile("(a*)*");
Matcher tm = tp.matcher("aaa");
@@ -1023,84 +1073,59 @@ public class MatcherTest extends TestCase {
assertNull(mat.group(3));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test doesn't verify Matcher and should be moved " +
- "to PatterTest",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = { java.lang.String.class,
- java.lang.CharSequence.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "matches",
+ args = {}
)
public void testUnicode() {
- assertTrue(Pattern.matches("\\x61a", "aa"));
+ assertTrue(Pattern.compile("\\x61a").matcher("aa").matches());
// assertTrue(Pattern.matches("\\u0061a", "aa"));
- assertTrue(Pattern.matches("\\0141a", "aa"));
- assertTrue(Pattern.matches("\\0777", "?7"));
+ assertTrue(Pattern.compile("\\0141a").matcher("aa").matches());
+ assertTrue(Pattern.compile("\\0777").matcher("?7").matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Doesn't verify Matcher and should be moved " +
- "to PatterTest",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = { java.lang.String.class,
- java.lang.CharSequence.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "matches",
+ args = {}
)
public void testUnicodeCategory() {
- assertTrue(Pattern.matches("\\p{Ll}", "k")); // Unicode lower case
- assertTrue(Pattern.matches("\\P{Ll}", "K")); // Unicode non-lower
+ assertTrue(Pattern.compile("\\p{Ll}").matcher("k").matches()); // Unicode lower case
+ assertTrue(Pattern.compile("\\P{Ll}").matcher("K").matches()); // Unicode non-lower
// case
- assertTrue(Pattern.matches("\\p{Lu}", "K")); // Unicode upper case
- assertTrue(Pattern.matches("\\P{Lu}", "k")); // Unicode non-upper
+ assertTrue(Pattern.compile("\\p{Lu}").matcher("K").matches()); // Unicode upper case
+ assertTrue(Pattern.compile("\\P{Lu}").matcher("k").matches()); // Unicode non-upper
// case
// combinations
- assertTrue(Pattern.matches("[\\p{L}&&[^\\p{Lu}]]", "k"));
- assertTrue(Pattern.matches("[\\p{L}&&[^\\p{Ll}]]", "K"));
- assertFalse(Pattern.matches("[\\p{L}&&[^\\p{Lu}]]", "K"));
- assertFalse(Pattern.matches("[\\p{L}&&[^\\p{Ll}]]", "k"));
+ assertTrue(Pattern.compile("[\\p{L}&&[^\\p{Lu}]]").matcher("k").matches());
+ assertTrue(Pattern.compile("[\\p{L}&&[^\\p{Ll}]]").matcher("K").matches());
+ assertFalse(Pattern.compile("[\\p{L}&&[^\\p{Lu}]]").matcher("K").matches());
+ assertFalse(Pattern.compile("[\\p{L}&&[^\\p{Ll}]]").matcher("k").matches());
// category/character combinations
- assertFalse(Pattern.matches("[\\p{L}&&[^a-z]]", "k"));
- assertTrue(Pattern.matches("[\\p{L}&&[^a-z]]", "K"));
+ assertFalse(Pattern.compile("[\\p{L}&&[^a-z]]").matcher("k").matches());
+ assertTrue(Pattern.compile("[\\p{L}&&[^a-z]]").matcher("K").matches());
- assertTrue(Pattern.matches("[\\p{Lu}a-z]", "k"));
- assertTrue(Pattern.matches("[a-z\\p{Lu}]", "k"));
+ assertTrue(Pattern.compile("[\\p{Lu}a-z]").matcher("k").matches());
+ assertTrue(Pattern.compile("[a-z\\p{Lu}]").matcher("k").matches());
- assertFalse(Pattern.matches("[\\p{Lu}a-d]", "k"));
- assertTrue(Pattern.matches("[a-d\\p{Lu}]", "K"));
+ assertFalse(Pattern.compile("[\\p{Lu}a-d]").matcher("k").matches());
+ assertTrue(Pattern.compile("[a-d\\p{Lu}]").matcher("K").matches());
// assertTrue(Pattern.matches("[\\p{L}&&[^\\p{Lu}&&[^K]]]", "K"));
- assertFalse(Pattern.matches("[\\p{L}&&[^\\p{Lu}&&[^G]]]", "K"));
-
- }
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test doesn't verify Matcher and should be moved to " +
- "PatterTest.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = { java.lang.CharSequence.class,
- int.class })
- }
- )
- public void testSplitEmpty() {
-
- Pattern pat = Pattern.compile("");
- String[] s = pat.split("", -1);
+ assertFalse(Pattern.compile("[\\p{L}&&[^\\p{Lu}&&[^G]]]").matcher("K").matches());
- assertEquals(1, s.length);
- assertEquals("", s[0]);
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies that find() method works correctly " +
- "with $ pattern.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies that find() method works correctly with $ pattern.",
+ method = "find",
+ args = {}
)
public void testFindDollar() {
Matcher mat = Pattern.compile("a$").matcher("a\n");
@@ -1111,12 +1136,11 @@ public class MatcherTest extends TestCase {
/*
* Verify if the Matcher can match the input when region is changed
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies matches() method for the specified region.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches() method for the specified region.",
+ method = "matches",
+ args = {}
)
public void testMatchesRegionChanged() {
// Regression for HARMONY-610
@@ -1130,12 +1154,12 @@ public class MatcherTest extends TestCase {
// BEGIN android-note
// Test took ages, now going in steps of 16 code points to speed things up.
// END android-note
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The stress test for matches(String regex) method from String class.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The stress test for matches(String regex) method from String class.",
+ clazz = String.class,
+ method = "matches",
+ args = {java.lang.String.class}
)
public void testAllCodePoints() {
// Regression for HARMONY-3145
@@ -1175,13 +1199,11 @@ public class MatcherTest extends TestCase {
/*
* Verify if the Matcher behaves correct when region is changed
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies find() method for specified region in " +
- "positive case.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies find() method for specified region in positive case.",
+ method = "find",
+ args = {}
)
public void testFindRegionChanged() {
// Regression for HARMONY-625
@@ -1201,13 +1223,11 @@ public class MatcherTest extends TestCase {
* Verify if the Matcher behaves correct with pattern "c" when region is
* changed
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies find() method for specified region in " +
- "negative case.",
- targets = { @TestTarget(methodName = "find",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies find() method for specified region in negative case.",
+ method = "find",
+ args = {}
)
public void testFindRegionChanged2() {
// Regression for HARMONY-713
@@ -1221,35 +1241,14 @@ public class MatcherTest extends TestCase {
}
/**
- * @test java.util.regex.Matcher#quoteReplacement(String s)
- * test quoteReplacement(String) method.
- */
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the quoteReplacement(String s) method.",
- targets = { @TestTarget(methodName = "lookingAt",
- methodArgs = {java.lang.String.class})
- }
- )
- public void test_quoteReplacementLjava_lang_String() {
- String testPattern = "(((abb)a)(bb))";
- String testString = "$dollar and slash\\";
- Pattern pat = Pattern.compile(testPattern);
- Matcher mat = pat.matcher(testString);
-
- assertEquals("", "\\$dollar and slash\\\\", mat.quoteReplacement(testString));
- }
-
- /**
* @test java.util.regex.Matcher#regionStart()
* test regionStart() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the regionStart() method.",
- targets = { @TestTarget(methodName = "regionStart",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the regionStart() method.",
+ method = "regionStart",
+ args = {}
)
public void test_regionStart() {
String testPattern = "(abb)";
@@ -1268,12 +1267,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#regionEnd()
* test regionEnd() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the regionEnd() method.",
- targets = { @TestTarget(methodName = "regionEnd",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the regionEnd() method.",
+ method = "regionEnd",
+ args = {}
)
public void test_regionEnd() {
String testPattern = "(abb)";
@@ -1292,12 +1290,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#toMatchResult()
* test toMatchResult() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the toMatchResult method.",
- targets = { @TestTarget(methodName = "toMatchResult",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the toMatchResult method.",
+ method = "toMatchResult",
+ args = {}
)
public void test_toMatchResult() {
String testPattern = "(((abb)a)(bb))";
@@ -1320,12 +1317,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#usePattern(Pattern newPattern)
* test usePattern(Pattern newPattern) method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the usePattern(Pattern newPattern) method.",
- targets = { @TestTarget(methodName = "usePattern",
- methodArgs = {java.util.regex.Pattern.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the usePattern(Pattern newPattern) method.",
+ method = "usePattern",
+ args = {java.util.regex.Pattern.class}
)
public void test_usePatternLjava_util_regex_Pattern() {
String testPattern1 = "(((abb)a)(bb))";
@@ -1347,14 +1343,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#useAchoringBounds()
* test useAchoringBounds() method.
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies useAnchoringBounds method. " +
- "The same verification in assert methods for different " +
- "cases.",
- targets = { @TestTarget(methodName = "useAnchoringBounds",
- methodArgs = {boolean.class})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "useAnchoringBounds",
+ args = {boolean.class}
)
public void test_anchoringBounds() {
String testPattern = "^ro$";
@@ -1375,12 +1368,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#useTransparentBounds()
* test useTransparentBounds() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the useTransparentBounds(boolean b) method.",
- targets = { @TestTarget(methodName = "useTransparentBounds",
- methodArgs = {boolean.class})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the useTransparentBounds(boolean b) method.",
+ method = "useTransparentBounds",
+ args = {boolean.class}
)
public void test_transparentBounds() {
String testPattern = "and(?=roid)";
@@ -1412,13 +1404,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#hitEnd()
* test hitEnd() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies that hitEnd() method returns" +
- " correct value. ",
- targets = { @TestTarget(methodName = "hitEnd",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies that hitEnd() method returns correct value. ",
+ method = "hitEnd",
+ args = {}
)
public void test_hitEnd() {
String testPattern = "abb";
@@ -1436,12 +1426,11 @@ public class MatcherTest extends TestCase {
* @test java.util.regex.Matcher#requireEnd()
* test requireEnd() method.
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the requireEnd() method.",
- targets = { @TestTarget(methodName = "requireEnd",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the requireEnd() method.",
+ method = "requireEnd",
+ args = {}
)
public void test_requireEnd() {
String testPattern = "bba";
@@ -1464,12 +1453,11 @@ public class MatcherTest extends TestCase {
/*
* Regression test for HARMONY-674
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Special regression test for matches() method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Special regression test for matches() method.",
+ method = "matches",
+ args = {}
)
public void testPatternMatcher() throws Exception {
Pattern pattern = Pattern.compile("(?:\\d+)(?:pt)");
@@ -1479,5 +1467,5 @@ public class MatcherTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(MatcherTest.class);
}
-
+
}
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ModeTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ModeTest.java
index e01122d..bad03f7 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ModeTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ModeTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import junit.framework.TestCase;
@@ -32,18 +32,21 @@ import java.util.regex.PatternSyntaxException;
*/
@TestTargetClass(Pattern.class)
public class ModeTest extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies compile(String regex) and " +
- "compile(String regex, int flags) methods with " +
- "Pattern.CASE_INSENSITIVE mode.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class }),
- @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class,
- int.class})
- }
- )
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies compile(String regex) and compile(String regex, int flags) methods with Pattern.CASE_INSENSITIVE mode.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies compile(String regex) and compile(String regex, int flags) methods with Pattern.CASE_INSENSITIVE mode.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testCase() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -72,18 +75,20 @@ public class ModeTest extends TestCase {
assertEquals("doG", m.group(1));
assertFalse(m.find());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies compile(String regex) and " +
- "compile(String regex, int flags) methods with " +
- "Pattern.MULTILINE mode.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class }),
- @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class,
- int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies compile(String regex) and compile(String regex, int flags) methods with Pattern.MULTILINE mode.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies compile(String regex) and compile(String regex, int flags) methods with Pattern.MULTILINE mode.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testMultiline() throws PatternSyntaxException {
Pattern p;
Matcher m;
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Pattern2Test.java
index 66b0056..10d2534 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Pattern2Test.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/Pattern2Test.java
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
+import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import java.util.regex.Matcher;
@@ -33,14 +34,11 @@ import junit.framework.TestCase;
*/
public class Pattern2Test extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies " +
- "matches(String regex, CharSequence input) method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = { java.lang.String.class,
- java.lang.CharSequence.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matches(String regex, CharSequence input) method.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
)
public void testSimpleMatch() throws PatternSyntaxException {
Pattern p = Pattern.compile("foo.*");
@@ -62,16 +60,20 @@ public class Pattern2Test extends TestCase {
assertTrue(Pattern.matches("", ""));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for created pattern.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testCursors() {
Pattern p;
Matcher m;
@@ -126,16 +128,20 @@ public class Pattern2Test extends TestCase {
fail();
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for created pattern.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testGroups() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -189,16 +195,20 @@ public class Pattern2Test extends TestCase {
assertFalse(m.find());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for created pattern.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testReplace() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -246,16 +256,20 @@ public class Pattern2Test extends TestCase {
"I want <b> cheese </b>. <b> Please </b>."));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for created pattern.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testEscapes() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -452,15 +466,20 @@ public class Pattern2Test extends TestCase {
// } catch (PatternSyntaxException e) {
// }
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies patterns with different ranges of characters.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies patterns with different ranges of characters.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies patterns with different ranges of characters.",
+ method = "matcher",
+ args = {CharSequence.class}
+ )
+ })
public void testCharacterClasses() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -727,16 +746,20 @@ public class Pattern2Test extends TestCase {
// Test x|y pattern
// TODO
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for patterns with POSIX characters.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for patterns with POSIX characters.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for patterns with POSIX characters.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testPOSIXGroups() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -879,13 +902,13 @@ public class Pattern2Test extends TestCase {
// Test \p{Cntrl}
// TODO
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "TODO empty test.",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.ADDITIONAL,
+ notes = "TODO empty test",
+ method = "!",
+ args = {}
)
+ @BrokenTest("empty test")
public void testUnicodeCategories() throws PatternSyntaxException {
// Test Unicode categories using \p and \P
// One letter codes: L, M, N, P, S, Z, C
@@ -933,13 +956,11 @@ public class Pattern2Test extends TestCase {
// Co
// Cn
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies matcher(CharSequence input) method " +
- "for input specified by Unicode blocks.",
- targets = { @TestTarget(methodName = "matcher",
- methodArgs = { java.lang.CharSequence.class })
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies matcher(CharSequence input) method for input specified by Unicode blocks.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
)
public void testUnicodeBlocks() throws PatternSyntaxException {
Pattern p;
@@ -1010,13 +1031,13 @@ public class Pattern2Test extends TestCase {
// END android-changed
}
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "TODO empty test",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.ADDITIONAL,
+ notes = "TODO empty test",
+ method = "!",
+ args = {}
)
+ @BrokenTest("empty test")
public void testCapturingGroups() throws PatternSyntaxException {
// Test simple capturing groups
// TODO
@@ -1033,13 +1054,13 @@ public class Pattern2Test extends TestCase {
// Test \<num> with <num> out of range
// TODO
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "TODO empty test.",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.ADDITIONAL,
+ notes = "TODO empty test",
+ method = "!",
+ args = {}
)
+ @BrokenTest("empty test")
public void testRepeats() {
// Test ?
// TODO
@@ -1059,13 +1080,13 @@ public class Pattern2Test extends TestCase {
// Test {<n1>,<n2>}, with n1 < n2, n1 = n2 and n1 > n2 (illegal?)
// TODO
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "TODO empty test",
- targets = { @TestTarget(methodName = "",
- methodArgs = {})
- }
+ @TestTargetNew(
+ level = TestLevel.ADDITIONAL,
+ notes = "TODO empty test",
+ method = "!",
+ args = {}
)
+ @BrokenTest("empty test")
public void testAnchors() throws PatternSyntaxException {
// Test ^, default and MULTILINE
// TODO
@@ -1103,16 +1124,20 @@ public class Pattern2Test extends TestCase {
// Test negative lookbehind using (?<!...)
// TODO
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method and matcher " +
- "for created pattern.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method and matcher for created pattern.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testMisc() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -1172,12 +1197,11 @@ public class Pattern2Test extends TestCase {
// Test #<comment text>
// TODO
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) method.",
+ method = "compile",
+ args = {java.lang.String.class}
)
public void testCompile1() throws PatternSyntaxException {
Pattern pattern = Pattern
@@ -1185,13 +1209,11 @@ public class Pattern2Test extends TestCase {
String name = "iso-8859-1";
assertTrue(pattern.matcher(name).matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex, int flag) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class,
- int.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex, int flag) method.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
)
public void testCompile2() throws PatternSyntaxException {
String findString = "\\Qimport\\E";
@@ -1202,18 +1224,20 @@ public class Pattern2Test extends TestCase {
assertTrue(matcher.find(0));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) and " +
- "compile(String regex, int flag) method for " +
- "specific patterns.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class }),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class,
- int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) and compile(String regex, int flag) method for specific patterns.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) and compile(String regex, int flag) method for specific patterns.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testCompile3() throws PatternSyntaxException {
Pattern p;
Matcher m;
@@ -1295,14 +1319,11 @@ public class Pattern2Test extends TestCase {
assertTrue(m.group().equals(""));
assertFalse(m.find());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex, int flag) method " +
- "for specific string.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class,
- int.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex, int flag) method for specific string.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
)
public void testCompile4() throws PatternSyntaxException {
String findString = "\\Qpublic\\E";
@@ -1325,13 +1346,11 @@ public class Pattern2Test extends TestCase {
found = matcher.find();
assertFalse(found);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) method" +
- "for specific string.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) methodfor specific string.",
+ method = "compile",
+ args = {java.lang.String.class}
)
public void testCompile5() throws PatternSyntaxException {
Pattern p = Pattern.compile("^[0-9]");
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternErrorTest.java
index 3b1c6fc..a9b782b 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternErrorTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import java.util.regex.Pattern;
@@ -30,19 +30,20 @@ import junit.framework.TestCase;
*
*/
public class PatternErrorTest extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies compile(String regex) and " +
- "compile(String regex, int flag) method with " +
- "invalid parameters. Doesn't verify " +
- "IllegalArgumentException, PatternSyntaxException.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class }),
- @TestTarget(methodName = "compile",
- methodArgs = { java.lang.String.class,
- int.class })
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) and compile(String regex, int flag) method with invalid parameters. Doesn't verify IllegalArgumentException, PatternSyntaxException.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies compile(String regex) and compile(String regex, int flag) method with invalid parameters. Doesn't verify IllegalArgumentException, PatternSyntaxException.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testCompileErrors() throws Exception {
// null regex string - should get NullPointerException
try {
diff --git a/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.java
new file mode 100644
index 0000000..9f3f389
--- /dev/null
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.regex.tests.java.util.regex;
+
+import java.util.regex.PatternSyntaxException;
+
+import junit.framework.TestCase;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargetClass;
+
+@TestTargetClass(PatternSyntaxException.class)
+public class PatternSyntaxExceptionTest extends TestCase {
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "PatternSyntaxException",
+ args = {java.lang.String.class, java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getDescription",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getPattern",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getIndex",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "getMessage",
+ args = {}
+ )
+ })
+ public void testPatternSyntaxException() {
+ // Normal case
+ PatternSyntaxException e = new PatternSyntaxException("Foo", "Bar", 0);
+ assertEquals("Foo", e.getDescription());
+ assertEquals("Bar", e.getPattern());
+ assertEquals(0, e.getIndex());
+
+ String s = e.getMessage();
+ assertTrue(s.contains("Foo"));
+ assertTrue(s.contains("Bar"));
+ assertTrue(s.contains("0"));
+
+ // No description specified
+ e = new PatternSyntaxException(null, "Bar", 0);
+ assertEquals(null, e.getDescription());
+ assertEquals("Bar", e.getPattern());
+ assertEquals(0, e.getIndex());
+
+ s = e.getMessage();
+ assertFalse(s.contains("Foo"));
+ assertTrue(s.contains("Bar"));
+ assertTrue(s.contains("0"));
+
+ // No pattern specified
+ e = new PatternSyntaxException("Foo", null, 0);
+ assertEquals("Foo", e.getDescription());
+ assertEquals(null, e.getPattern());
+ assertEquals(0, e.getIndex());
+
+ s = e.getMessage();
+ assertTrue(s.contains("Foo"));
+ assertFalse(s.contains("Bar"));
+ assertTrue(s.contains("0"));
+
+ // Neither description nor pattern specified
+ e = new PatternSyntaxException(null, null, 0);
+ assertEquals(null, e.getDescription());
+ assertEquals(null, e.getPattern());
+ assertEquals(0, e.getIndex());
+
+ s = e.getMessage();
+ assertFalse(s.contains("Foo"));
+ assertFalse(s.contains("Bar"));
+ assertTrue(s.contains("0"));
+
+ // No index specified
+ e = new PatternSyntaxException("Foo", "Bar", -1);
+ assertEquals(-1, e.getIndex());
+
+ s = e.getMessage();
+ assertFalse(s.contains("^"));
+
+ // No pattern, but index specified
+ e = new PatternSyntaxException("Foo", null, 0);
+ assertEquals(0, e.getIndex());
+
+ s = e.getMessage();
+ assertFalse(s.contains("^"));
+ }
+
+}
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternTest.java
index 52e0a84..21672b7 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/PatternTest.java
@@ -15,11 +15,12 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
+import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import java.io.Serializable;
@@ -32,7 +33,17 @@ import junit.framework.TestCase;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
-@TestTargetClass(Pattern.class)
+@TestTargetClass(
+ value = Pattern.class,
+ untestedMethods= {
+ @TestTargetNew(
+ level = TestLevel.NOT_FEASIBLE,
+ notes = "finalize is hard to test since the implementation only calls a native function",
+ method = "finalize",
+ args = {}
+ )
+ }
+)
public class PatternTest extends TestCase {
String[] testPatterns = {
"(a|b)*abb",
@@ -85,24 +96,25 @@ public class PatternTest extends TestCase {
}
- @TestInfo(
- level = TestLevel.TODO,
- purpose = "", targets = {}
- )
+ @TestTargetNew(
+ level = TestLevel.ADDITIONAL,
+ notes = "TODO empty test",
+ method = "!",
+ args = {}
+ )
+ @BrokenTest("empty test")
public void testMatcher() {
}
/*
* Class under test for String[] split(CharSequence, int)
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of split" +
- "split(java.lang.String, int) method.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.String.class, int.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of splitsplit(java.lang.String, int) method.",
+ method = "split",
+ args = {CharSequence.class, int.class}
+ )
public void testSplitCharSequenceint() {
// splitting CharSequence which ends with pattern
// bug6193
@@ -180,14 +192,12 @@ public class PatternTest extends TestCase {
/*
* Class under test for String[] split(CharSequence)
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of split" +
- "split(java.lang.String) method.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of splitsplit(java.lang.String) method.",
+ method = "split",
+ args = {CharSequence.class}
+ )
public void testSplitCharSequence() {
String s[];
Pattern pat = Pattern.compile("b");
@@ -207,13 +217,12 @@ public class PatternTest extends TestCase {
// bug6544
}
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "Verifies the functionality of pattern() method.",
- targets = { @TestTarget(methodName = "pattern",
- methodArgs = {})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "Verifies the functionality of pattern() method.",
+ method = "pattern",
+ args = {}
+ )
public void testPattern() {
/* Positive assertion test. */
for (String aPattern : testPatterns) {
@@ -226,13 +235,12 @@ public class PatternTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testCompile() {
/* Positive assertion test. */
for (String aPattern : testPatterns) {
@@ -265,14 +273,12 @@ public class PatternTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String)" +
- " method for different flags.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method for different flags.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFlags() {
String baseString;
String testString;
@@ -446,14 +452,12 @@ public class PatternTest extends TestCase {
* since could not find that info
*/
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of flags()" +
- " method for default flags.",
- targets = { @TestTarget(methodName = "flags",
- methodArgs = {})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of flags() method for default flags.",
+ method = "flags",
+ args = {}
+ )
public void testFlagsCompileDefault() {
for (String pat : testPatternsAlt) {
try {
@@ -471,16 +475,20 @@ public class PatternTest extends TestCase {
* improve.
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String, int) &" +
- " flags() methods. Checks that copmilation was corect.",
- targets = { @TestTarget(methodName = "flags",
- methodArgs = {}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & flags() methods. Checks that compilation was corect.",
+ method = "flags",
+ args = {}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & flags() methods. Checks that compilation was corect.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testFlagsCompileValid() {
for (String pat : testPatternsAlt) {
for (int flags : flagsSet) {
@@ -498,14 +506,12 @@ public class PatternTest extends TestCase {
* Class under test for Pattern compile(String, int)
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method." +
- "Checks that correct exceptions were thrown.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.Checks that correct exceptions were thrown.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testCompileStringint() {
/*
* these tests are needed to verify that appropriate exceptions are
@@ -561,14 +567,12 @@ public class PatternTest extends TestCase {
/*
* Class under test for Pattern compile(String)
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method." +
- "Checks that correct exceptions were thrown.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.Checks that correct exceptions were thrown.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testQuantCompileNeg() {
String[] patterns = { "5{,2}", "{5asd", "{hgdhg", "{5,hjkh", "{,5hdsh",
"{5,3shdfkjh}" };
@@ -591,13 +595,12 @@ public class PatternTest extends TestCase {
assertNotNull(Pattern.compile(pattern));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testQuantCompilePos() {
String[] patterns = {/* "(abc){1,3}", */"abc{2,}", "abc{5}" };
for (String element : patterns) {
@@ -605,14 +608,12 @@ public class PatternTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile() method." +
- " Also tested methods from matcher: matches(), start(int), group(int)",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile() method. Also tested methods from matcher: matches(), start(int), group(int)",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testQuantComposition() {
String pattern = "(a{1,3})aab";
java.util.regex.Pattern pat = java.util.regex.Pattern.compile(pattern);
@@ -622,16 +623,12 @@ public class PatternTest extends TestCase {
mat.group(1);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of matches(java.lang.String," +
- "java.lang.CharSequence) method. Doesn't verify " +
- "PatternSyntaxException.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class,
- java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testMatches() {
String[][] posSeq = {
{ "abb", "ababb", "abababbababb", "abababbababbabababbbbbabb" },
@@ -660,15 +657,32 @@ public class PatternTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of matches(java.lang.String," +
- "java.lang.CharSequence) method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class,
- java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies exception",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
+ public void testMatchesException() {
+ /* Negative assertion test. */
+ for (String aPattern : wrongTestPatterns) {
+ try {
+ Pattern.matches(aPattern, "Foo");
+ fail("PatternSyntaxException is expected");
+ } catch (PatternSyntaxException pse) {
+ /* OKAY */
+ } catch (Exception e) {
+ fail("Unexpected exception: " + e);
+ }
+ }
+ }
+
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of matches(java.lang.String,java.lang.CharSequence) method.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testTimeZoneIssue() {
Pattern p = Pattern.compile("GMT(\\+|\\-)(\\d+)(:(\\d+))?");
Matcher m = p.matcher("GMT-9:45");
@@ -681,15 +695,12 @@ public class PatternTest extends TestCase {
// BEGIN android-changed
// Removed one pattern that is buggy on the JDK. We don't want to duplicate that.
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of matches(java.lang.String," +
- "java.lang.CharSequence) method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class,
- java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of matches(java.lang.String,java.lang.CharSequence) method.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testCompileRanges() {
String[] correctTestPatterns = { "[^]*abb]*", /* "[^a-d[^m-p]]*abb", */
"[a-d\\d]*abb", "[abc]*abb", "[a-e&&[de]]*abb", "[^abc]*abb",
@@ -723,15 +734,12 @@ public class PatternTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of matches(java.lang.String," +
- "java.lang.CharSequence) method for ranged patterns.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class,
- java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of matches(java.lang.String,java.lang.CharSequence) method for ranged patterns.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testRangesSpecialCases() {
String neg_patterns[] = { "[a-&&[b-c]]", "[a-\\w]", "[b-a]", "[]" };
@@ -755,27 +763,22 @@ public class PatternTest extends TestCase {
}
// END android-changed
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of matches(java.lang.String," +
- "java.lang.CharSequence) method.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class,
- java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of matches(java.lang.String,java.lang.CharSequence) method.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testZeroSymbols() {
assertTrue(Pattern.matches("[\0]*abb", "\0\0\0\0\0\0abb"));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of matcher(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of matcher(java.lang.String) method.",
+ method = "matcher",
+ args = {CharSequence.class}
+ )
public void testEscapes() {
Pattern pat = Pattern.compile("\\Q{]()*?");
Matcher mat = pat.matcher("{]()*?");
@@ -783,36 +786,22 @@ public void testZeroSymbols() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testBug181() {
Pattern.compile("[\\t-\\r]");
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
- public void disabled_testBug187() {
- Pattern
- .compile("|(?idmsux-idmsux)|(?idmsux-idmsux)|[^|\\[-\\0274|\\,-\\\\[^|W\\}\\nq\\x65\\002\\xFE\\05\\06\\00\\x66\\x47i\\,\\xF2\\=\\06\\u0EA4\\x9B\\x3C\\f\\|\\{\\xE5\\05\\r\\u944A\\xCA\\e|\\x19\\04\\x07\\04\\u607B\\023\\0073\\x91Tr\\0150\\x83]]?(?idmsux-idmsux:\\p{Alpha}{7}?)||(?<=[^\\uEC47\\01\\02\\u3421\\a\\f\\a\\013q\\035w\\e])(?<=\\p{Punct}{0,}?)(?=^\\p{Lower})(?!\\b{8,14})(?<![|\\00-\\0146[^|\\04\\01\\04\\060\\f\\u224DO\\x1A\\xC4\\00\\02\\0315\\0351\\u84A8\\xCBt\\xCC\\06|\\0141\\00\\=\\e\\f\\x6B\\0026Tb\\040\\x76xJ&&[\\\\-\\]\\05\\07\\02\\u2DAF\\t\\x9C\\e\\0023\\02\\,X\\e|\\u6058flY\\u954C]]]{5}?)(?<=\\p{Sc}{8}+)[^|\\026-\\u89BA|o\\u6277\\t\\07\\x50&&\\p{Punct}]{8,14}+((?<=^\\p{Punct})|(?idmsux-idmsux)||(?>[\\x3E-\\]])|(?idmsux-idmsux:\\p{Punct})|(?<![\\0111\\0371\\xDF\\u6A49\\07\\u2A4D\\00\\0212\\02Xd-\\xED[^\\a-\\0061|\\0257\\04\\f\\[\\0266\\043\\03\\x2D\\042&&[^\\f-\\]&&\\s]]])|(?>[|\\n\\042\\uB09F\\06\\u0F2B\\uC96D\\x89\\uC166\\xAA|\\04-\\][^|\\a\\|\\rx\\04\\uA770\\n\\02\\t\\052\\056\\0274\\|\\=\\07\\e|\\00-\\x1D&&[^\\005\\uB15B\\uCDAC\\n\\x74\\0103\\0147\\uD91B\\n\\062G\\u9B4B\\077\\}\\0324&&[^\\0302\\,\\0221\\04\\u6D16\\04xy\\uD193\\[\\061\\06\\045\\x0F|\\e\\xBB\\f\\u1B52\\023\\u3AD2\\033\\007\\022\\}\\x66\\uA63FJ-\\0304]]]]{0,0})||(?<![^|\\0154U\\u0877\\03\\fy\\n\\|\\0147\\07-\\=[|q\\u69BE\\0243\\rp\\053\\02\\x33I\\u5E39\\u9C40\\052-\\xBC[|\\0064-\\?|\\uFC0C\\x30\\0060\\x45\\\\\\02\\?p\\xD8\\0155\\07\\0367\\04\\uF07B\\000J[^|\\0051-\\{|\\u9E4E\\u7328\\]\\u6AB8\\06\\x71\\a\\]\\e\\|KN\\u06AA\\0000\\063\\u2523&&[\\005\\0277\\x41U\\034\\}R\\u14C7\\u4767\\x09\\n\\054Ev\\0144\\<\\f\\,Q-\\xE4]]]]]{3}+)|(?>^+)|(?![^|\\|\\nJ\\t\\<\\04E\\\\\\t\\01\\\\\\02\\|\\=\\}\\xF3\\uBEC2\\032K\\014\\uCC5F\\072q\\|\\0153\\xD9\\0322\\uC6C8[^\\t\\0342\\x34\\x91\\06\\{\\xF1\\a\\u1710\\?\\xE7\\uC106\\02pF\\<&&[^|\\]\\064\\u381D\\u50CF\\eO&&[^|\\06\\x2F\\04\\045\\032\\u8536W\\0377\\0017|\\x06\\uE5FA\\05\\xD4\\020\\04c\\xFC\\02H\\x0A\\r]]]]+?)(?idmsux-idmsux)|(?<![|\\r-\\,&&[I\\t\\r\\0201\\xDB\\e&&[^|\\02\\06\\00\\<\\a\\u7952\\064\\051\\073\\x41\\?n\\040\\0053\\031&&[\\x15-\\|]]]]{8,11}?)(?![^|\\<-\\uA74B\\xFA\\u7CD2\\024\\07n\\<\\x6A\\0042\\uE4FF\\r\\u896B\\[\\=\\042Y&&^\\p{ASCII}]++)|(?<![R-\\|&&[\\a\\0120A\\u6145\\<\\050-d[|\\e-\\uA07C|\\016-\\u80D9]]]{1,}+)|(?idmsux-idmsux)|(?idmsux-idmsux)|(?idmsux-idmsux:\\B{6,}?)|(?<=\\D{5,8}?)|(?>[\\{-\\0207|\\06-\\0276\\p{XDigit}])(?idmsux-idmsux:[^|\\x52\\0012\\]u\\xAD\\0051f\\0142\\\\l\\|\\050\\05\\f\\t\\u7B91\\r\\u7763\\{|h\\0104\\a\\f\\0234\\u2D4F&&^\\P{InGreek}]))");
- }
-
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testOrphanQuantifiers() {
try {
Pattern.compile("+++++");
@@ -821,13 +810,12 @@ public void testZeroSymbols() {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testOrphanQuantifiers2() {
try {
Pattern pat = Pattern.compile("\\d+*");
@@ -837,15 +825,20 @@ public void testZeroSymbols() {
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
+ })
public void testBug197() {
Object[] vals = { ":", new Integer(2),
new String[] { "boo", "and:foo" }, ":", new Integer(5),
@@ -872,13 +865,12 @@ public void testZeroSymbols() {
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testURIPatterns() {
String URI_REGEXP_STR = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?";
String SCHEME_REGEXP_STR = "^[a-zA-Z]{1}[\\w+-.]+$";
@@ -897,14 +889,12 @@ public void testZeroSymbols() {
Pattern HOSTNAME_REGEXP = Pattern.compile(HOSTNAME_REGEXP_STR);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases1() {
Pattern pat = Pattern.compile(".*\n");
Matcher mat = pat.matcher("a\n");
@@ -913,14 +903,12 @@ public void testZeroSymbols() {
assertEquals("a\n", mat.group());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases2() {
Pattern pat = Pattern.compile(".*A");
Matcher mat = pat.matcher("aAa");
@@ -929,14 +917,12 @@ public void testZeroSymbols() {
assertEquals("aA", mat.group());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases3() {
Pattern pat = Pattern.compile(".*A");
Matcher mat = pat.matcher("a\naA\n");
@@ -945,14 +931,12 @@ public void testZeroSymbols() {
assertEquals("aA", mat.group());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases4() {
Pattern pat = Pattern.compile("A.*");
Matcher mat = pat.matcher("A\n");
@@ -961,14 +945,12 @@ public void testZeroSymbols() {
assertEquals("A", mat.group());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases5() {
Pattern pat = Pattern.compile(".*A.*");
Matcher mat = pat.matcher("\nA\naaa\nA\naaAaa\naaaA\n");
@@ -980,14 +962,12 @@ public void testZeroSymbols() {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testFindBoundaryCases6() {
String[] res = { "", "a", "", "" };
Pattern pat = Pattern.compile(".*");
@@ -999,36 +979,20 @@ public void testZeroSymbols() {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of " +
- "compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
- public void disabled_testFindBoundaryCases7() {
- String[] res = { "", "a", "", "" };
- Pattern pat = Pattern.compile(".*");
- Matcher mat = pat.matcher("\na\n");
- int k = 0;
-
- for (; mat.find(); k++) {
- System.out.println(mat.group());
- System.out.flush();
- }
- }
-
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testBackReferences() {
Pattern pat = Pattern.compile("(\\((\\w*):(.*):(\\2)\\))");
Matcher mat = pat
@@ -1046,40 +1010,20 @@ public void testZeroSymbols() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
- public void disabled_testBackReferences1() {
- Pattern pat = Pattern.compile("(\\((\\w*):(.*):(\\2)\\))");
- Matcher mat = pat
- .matcher("(start1: word :start1)(start2: word :start2)");
- int k = 1;
- for (; mat.find(); k++) {
- System.out.println(mat.group(2));
- System.out.println(mat.group(3));
- System.out.println(mat.group(4));
- }
-
- assertEquals(3, k);
- }
-
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String, int) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, java.lang.Integer.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testNewLine() {
Pattern pat = Pattern.compile("(^$)*\n", Pattern.MULTILINE);
Matcher mat = pat.matcher("\r\n\n");
@@ -1090,33 +1034,38 @@ public void testZeroSymbols() {
assertEquals(2, counter);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String, int) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, java.lang.Integer.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testFindGreedy() {
Pattern pat = Pattern.compile(".*aaa", Pattern.DOTALL);
Matcher mat = pat.matcher("aaaa\naaa\naaaaaa");
mat.matches();
assertEquals(15, mat.end());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies serialization/deserialization.",
- targets = {
- @TestTarget(
- methodName = "!SerializationSelf",
- methodArgs = {}
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies serialization/deserialization.",
+ method = "!SerializationSelf",
+ args = {}
),
- @TestTarget(
- methodName = "!SerializationGolden",
- methodArgs = {}
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies serialization/deserialization.",
+ method = "!SerializationGolden",
+ args = {}
)
})
public void testSerialization() throws Exception {
@@ -1132,16 +1081,20 @@ public void testZeroSymbols() {
SerializationTest.verifySelf(pat, comparator);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String, int) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, java.lang.Integer.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testSOLQuant() {
Pattern pat = Pattern.compile("$*", Pattern.MULTILINE);
Matcher mat = pat.matcher("\n\n");
@@ -1153,14 +1106,12 @@ public void testZeroSymbols() {
assertEquals(3, counter);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) " +
- "method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testIllegalEscape() {
try {
Pattern.compile("\\y");
@@ -1169,28 +1120,31 @@ public void testZeroSymbols() {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testEmptyFamily() {
Pattern.compile("\\p{Lower}");
String a = "*";
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testNonCaptConstr() {
// Flags
Pattern pat = Pattern.compile("(?i)b*(?-i)a*");
@@ -1260,14 +1214,13 @@ public void testZeroSymbols() {
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
- public void disabled_testCorrectReplacementBackreferencedJointSet() {
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
+ public void testCorrectReplacementBackreferencedJointSet() {
Pattern pat = Pattern.compile("ab(a)*\\1");
pat = Pattern.compile("abc(cd)fg");
pat = Pattern.compile("aba*cd");
@@ -1285,32 +1238,40 @@ public void testZeroSymbols() {
pat = Pattern.compile("ab(a){1,3}?(c)d");
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testCompilePatternWithTerminatorMark() {
Pattern pat = Pattern.compile("a\u0000\u0000cd");
Matcher mat = pat.matcher("a\u0000\u0000cd");
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testAlternations() {
String baseString = "|a|bc";
Pattern pat = Pattern.compile(baseString);
@@ -1379,16 +1340,20 @@ public void testZeroSymbols() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testMatchWithGroups() {
String baseString = "jwkerhjwehrkwjehrkwjhrwkjehrjwkehrjkwhrkwehrkwhrkwrhwkhrwkjehr";
String pattern = ".*(..).*\\1.*";
@@ -1400,31 +1365,32 @@ public void testZeroSymbols() {
assertTrue(Pattern.compile(pattern).matcher(baseString).find());
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies split method for empty string.",
- targets = {
- @TestTarget(
- methodName = "split",
- methodArgs = {java.lang.CharSequence.class}
- )
- })
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies split method for empty string.",
+ method = "split",
+ args = {java.lang.CharSequence.class}
+ )
public void testSplitEmptyCharSequence() {
String s1 = "";
String[] arr = s1.split(":");
assertEquals(arr.length, 1);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of compile(java.lang.String) & " +
- "split(java.lang.CharSequence, int) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "split",
- methodArgs = {java.lang.CharSequence.class, int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of compile(java.lang.String) & split(java.lang.CharSequence, int) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of compile(java.lang.String) & split(java.lang.CharSequence, int) methods.",
+ method = "split",
+ args = {java.lang.CharSequence.class, int.class}
+ )
+ })
public void testSplitEndsWithPattern() {
assertEquals(",,".split(",", 3).length, 3);
assertEquals(",,".split(",", 4).length, 3);
@@ -1433,28 +1399,30 @@ public void testZeroSymbols() {
assertEquals(Pattern.compile("b").split("ab", -1).length, 2);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of matches(java.lang.String), " +
- "java.lang.CharSequence) method for case insensitive flags.",
- targets = { @TestTarget(methodName = "matches",
- methodArgs = {java.lang.String.class, java.lang.CharSequence.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of matches(java.lang.String), java.lang.CharSequence) method for case insensitive flags.",
+ method = "matches",
+ args = {java.lang.String.class, java.lang.CharSequence.class}
+ )
public void testCaseInsensitiveFlag() {
assertTrue(Pattern.matches("(?i-:AbC)", "ABC"));
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testEmptyGroups() {
Pattern pat = Pattern.compile("ab(?>)cda");
Matcher mat = pat.matcher("abcda");
@@ -1469,16 +1437,20 @@ public void testZeroSymbols() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL, //isCompiled checking not needed test should fail in case of exception
- purpose = "Verifies the functionality of compile(java.lang.String) &" +
- " compile(java.lang.String, int) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, int.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ )
+ })
public void testCompileNonCaptGroup() {
boolean isCompiled = false;
@@ -1497,16 +1469,20 @@ public void testZeroSymbols() {
assertTrue(isCompiled);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testEmbeddedFlags() {
String baseString = "(?i)((?s)a)";
String testString = "A";
@@ -1539,13 +1515,12 @@ public void testZeroSymbols() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL, //isCompiled checking not needed test should fail in case of exception
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testAltWithFlags() {
boolean isCompiled = false;
@@ -1558,16 +1533,20 @@ public void testZeroSymbols() {
assertTrue(isCompiled);
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testRestoreFlagsAfterGroup() {
String baseString = "abc((?x)d) a";
String testString = "abcd a";
@@ -1581,13 +1560,12 @@ public void testRestoreFlagsAfterGroup() {
* Verify if the Pattern support the following character classes:
* \p{javaLowerCase} \p{javaUpperCase} \p{javaWhitespace} \p{javaMirrored}
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) method.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) method.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
public void testCompileCharacterClass() {
// Regression for HARMONY-606, 696
Pattern pattern = Pattern.compile("\\p{javaLowerCase}");
@@ -1909,16 +1887,20 @@ public void testRestoreFlagsAfterGroup() {
// */}
// END android-removed
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testRangesWithSurrogatesSupplementary() {
String patString = "[abc\uD8D2]";
String testString = "\uD8D2";
@@ -1985,16 +1967,20 @@ public void testRestoreFlagsAfterGroup() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testSequencesWithSurrogatesSupplementary() {
String patString = "abcd\uD8D3";
String testString = "abcd\uD8D3\uDFFC";
@@ -2037,16 +2023,20 @@ public void testRestoreFlagsAfterGroup() {
* s original test was fixed to pass on RI
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testPredefinedClassesWithSurrogatesSupplementary() {
String patString = "[123\\D]";
String testString = "a";
@@ -2148,18 +2138,26 @@ public void testRestoreFlagsAfterGroup() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- " compile(java.lang.String, int) matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, int.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testDotConstructionWithSurrogatesSupplementary() {
String patString = ".";
String testString = "\uD9A0\uDE81";
@@ -2199,15 +2197,12 @@ public void testRestoreFlagsAfterGroup() {
/**
* s java.util.regex.Pattern.quote(String)
*/
- @TestInfo(
- level = TestLevel.COMPLETE,
- purpose = "",
- targets = {
- @TestTarget(
- methodName = "quote",
- methodArgs = {java.lang.String.class}
- )
- })
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "quote",
+ args = {java.lang.String.class}
+ )
public void test_quoteLjava_lang_String() {
for (String aPattern : testPatterns) {
Pattern p = Pattern.compile(aPattern);
@@ -2229,16 +2224,20 @@ public void testRestoreFlagsAfterGroup() {
* coped from test for matches method
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void test_matcherLjava_lang_StringLjava_lang_CharSequence() {
String[][] posSeq = {
{ "abb", "ababb", "abababbababb", "abababbababbabababbbbbabb" },
@@ -2267,16 +2266,20 @@ public void testRestoreFlagsAfterGroup() {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testQuantifiersWithSurrogatesSupplementary() {
String patString = "\uD9A0\uDE81*abc";
String testString = "\uD9A0\uDE81\uD9A0\uDE81abc";
@@ -2289,16 +2292,20 @@ public void testRestoreFlagsAfterGroup() {
assertTrue(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testAlternationsWithSurrogatesSupplementary() {
String patString = "\uDE81|\uD9A0\uDE81|\uD9A0";
String testString = "\uD9A0";
@@ -2319,18 +2326,26 @@ public void testRestoreFlagsAfterGroup() {
assertFalse(mat.matches());
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of compile(java.lang.String) & " +
- "compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class, int.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of compile(java.lang.String) & compile(java.lang.String, int) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testGroupsWithSurrogatesSupplementary() {
//this pattern matches nothing
@@ -2350,16 +2365,20 @@ public void testRestoreFlagsAfterGroup() {
/*
* Regression test for HARMONY-688
*/
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "The test verifies the functionality of compile(java.lang.String) & " +
- "matcher(java.lang.CharSequence) methods.",
- targets = { @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "matcher",
- methodArgs = {java.lang.CharSequence.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test verifies the functionality of compile(java.lang.String) & matcher(java.lang.CharSequence) methods.",
+ method = "matcher",
+ args = {java.lang.CharSequence.class}
+ )
+ })
public void testUnicodeCategoryWithSurrogatesSupplementary() {
Pattern p = Pattern.compile("\\p{javaLowerCase}");
Matcher matcher = p.matcher("\uD801\uDC28");
@@ -2369,4 +2388,33 @@ public void testRestoreFlagsAfterGroup() {
public static void main(String[] args) {
junit.textui.TestRunner.run(PatternTest.class);
}
+
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "The test doesn't verify Matcher and should be moved to PatterTest.",
+ method = "split",
+ args = {java.lang.CharSequence.class, int.class}
+ )
+ public void testSplitEmpty() {
+
+ Pattern pat = Pattern.compile("");
+ String[] s = pat.split("", -1);
+
+ assertEquals(1, s.length);
+ assertEquals("", s[0]);
+ }
+
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ notes = "",
+ method = "toString",
+ args = {}
+ )
+ public void testToString() {
+ for (int i = 0; i < testPatterns.length; i++) {
+ Pattern p = Pattern.compile(testPatterns[i]);
+ assertEquals(testPatterns[i], p.toString());
+ }
+ }
+
}
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ReplaceTest.java
index 077978b..82390e7 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/ReplaceTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import junit.framework.TestCase;
@@ -28,17 +28,20 @@ import java.util.regex.PatternSyntaxException;
@TestTargetClass(Matcher.class)
public class ReplaceTest extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the basic functionality of " +
- "replaceFirst(java.lang.String) & replaceAll(java.lang.String)" +
- " methods.",
- targets = { @TestTarget(methodName = "replaceFirst",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "replaceAll",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.",
+ method = "replaceFirst",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.",
+ method = "replaceAll",
+ args = {java.lang.String.class}
+ )
+ })
public void testSimpleReplace() throws PatternSyntaxException {
String target, pattern, repl;
@@ -53,17 +56,20 @@ public class ReplaceTest extends TestCase {
assertEquals("foobarxxxarfooxxxbarxxxt", m.replaceAll(repl));
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of " +
- "replaceFirst(java.lang.String) & replaceAll(java.lang.String)" +
- " methods.",
- targets = { @TestTarget(methodName = "replaceFirst",
- methodArgs = {java.lang.String.class}),
- @TestTarget(methodName = "replaceAll",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.",
+ method = "replaceFirst",
+ args = {java.lang.String.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of replaceFirst(java.lang.String) & replaceAll(java.lang.String) methods.",
+ method = "replaceAll",
+ args = {java.lang.String.class}
+ )
+ })
public void testCaptureReplace() {
String target, pattern, repl, s;
Pattern p = null;
@@ -95,14 +101,12 @@ public class ReplaceTest extends TestCase {
);
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of " +
- "replaceAll(java.lang.String) method with backslash chars.",
- targets = { @TestTarget(methodName = "replaceAll",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of replaceAll(java.lang.String) method with backslash chars.",
+ method = "replaceAll",
+ args = {java.lang.String.class}
+ )
public void testEscapeReplace() {
String target, pattern, repl, s;
diff --git a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java
index 4fd2243..ea615c0 100644
--- a/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java
+++ b/regex/src/test/java/org/apache/harmony/regex/tests/java/util/regex/SplitTest.java
@@ -1,8 +1,8 @@
-package org.apache.harmony.tests.java.util.regex;
+package org.apache.harmony.regex.tests.java.util.regex;
import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestInfo;
-import dalvik.annotation.TestTarget;
+import dalvik.annotation.TestTargets;
+import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestLevel;
import junit.framework.TestCase;
@@ -14,17 +14,20 @@ import java.util.regex.*;
*
*/
public class SplitTest extends TestCase {
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the basic functionality of " +
- "split(java.lang.CharSequence) & compile(java.lang.String)" +
- "methods.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.CharSequence.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of split(java.lang.CharSequence) & compile(java.lang.String)methods.",
+ method = "split",
+ args = {java.lang.CharSequence.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the basic functionality of split(java.lang.CharSequence) & compile(java.lang.String)methods.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
+ })
public void testSimple() {
Pattern p = Pattern.compile("/");
String[] results = p.split("have/you/done/it/right");
@@ -35,14 +38,12 @@ public class SplitTest extends TestCase {
}
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of " +
- "split(java.lang.CharSequence). Test uses not empty pattern.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.CharSequence.class, int.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of split(java.lang.CharSequence). Test uses not empty pattern.",
+ method = "split",
+ args = {java.lang.CharSequence.class, int.class}
+ )
public void testSplit1() throws PatternSyntaxException {
Pattern p = Pattern.compile(" ");
@@ -134,14 +135,12 @@ public class SplitTest extends TestCase {
assertEquals("dle z", tokens[2]);
}
- @TestInfo(
- level = TestLevel.PARTIAL_OK,
- purpose = "Verifies the functionality of " +
- "split(java.lang.CharSequence). Test uses empty pattern.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.CharSequence.class, int.class})
- }
- )
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of split(java.lang.CharSequence). Test uses empty pattern.",
+ method = "split",
+ args = {java.lang.CharSequence.class, int.class}
+ )
public void testSplit2() {
Pattern p = Pattern.compile("");
String s[];
@@ -169,17 +168,20 @@ public class SplitTest extends TestCase {
}
- @TestInfo(
- level = TestLevel.PARTIAL,
- purpose = "Verifies the functionality of " +
- "split(java.lang.CharSequence) & compile(java.lang.String," +
- " int) methods. Test uses empty pattern and supplementary chars.",
- targets = { @TestTarget(methodName = "split",
- methodArgs = {java.lang.CharSequence.class, int.class}),
- @TestTarget(methodName = "compile",
- methodArgs = {java.lang.String.class})
- }
- )
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of split(java.lang.CharSequence) & compile(java.lang.String, int) methods. Test uses empty pattern and supplementary chars.",
+ method = "split",
+ args = {java.lang.CharSequence.class, int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.PARTIAL_COMPLETE,
+ notes = "Verifies the functionality of split(java.lang.CharSequence) & compile(java.lang.String, int) methods. Test uses empty pattern and supplementary chars.",
+ method = "compile",
+ args = {java.lang.String.class}
+ )
+ })
public void testSplitSupplementaryWithEmptyString() {
/*
diff --git a/regex/src/test/java/tests/regex/AllTests.java b/regex/src/test/java/tests/regex/AllTests.java
index 23ea4b7..d590d08 100644
--- a/regex/src/test/java/tests/regex/AllTests.java
+++ b/regex/src/test/java/tests/regex/AllTests.java
@@ -29,9 +29,9 @@ public class AllTests {
}
public static Test suite() {
- TestSuite suite = new TestSuite("All regex test suites");
+ TestSuite suite = tests.TestSuiteFactory.createTestSuite("All regex test suites");
// $JUnit-BEGIN$
- suite.addTest(org.apache.harmony.tests.java.util.regex.AllTests.suite());
+ suite.addTest(org.apache.harmony.regex.tests.java.util.regex.AllTests.suite());
// $JUnit-END$
return suite;
}
diff --git a/regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser b/regex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser
index 623d6ac..623d6ac 100755
--- a/regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser
+++ b/regex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser
Binary files differ
diff --git a/regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternTest.golden.ser b/regex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternTest.golden.ser
index 6150adf..6150adf 100755
--- a/regex/src/test/resources/serialization/org/apache/harmony/tests/java/util/regex/PatternTest.golden.ser
+++ b/regex/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternTest.golden.ser
Binary files differ