@@ -0,0 +1,2033 @@
+// Copyright (C) 2009 The Android Open Source Project%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A// http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0A%0Apackage com.google.gwtexpui.safehtml.client;%0A%0Aimport junit.framework.TestCase;%0A%0Aimport java.util.Arrays;%0A%0Apublic class SafeHtml_ReplaceTest extends TestCase %7B%0A  public void testReplaceTwoLinks() %7B%0A    final RegexFindReplace%5B%5D repl = %7B//%0A        new RegexFindReplace(%22(issue%5C%5Cs(%5C%5Cd+))%22, %22%3Ca href=%5C%22?$2%5C%22%3E$1%3C/a%3E%22) //%0A        %7D;%0A    final SafeHtml o = html(%22A%5Cnissue 42%5Cnissue 9918%5CnB%22);%0A    final SafeHtml n = o.replaceAll(Arrays.asList(repl));%0A    assertNotSame(o, n);%0A    assertEquals(%22A%5Cn%22 //%0A        + %22%3Ca href=%5C%22?42%5C%22%3Eissue 42%3C/a%3E%5Cn%22 //%0A        + %22%3Ca href=%5C%22?9918%5C%22%3Eissue 9918%3C/a%3E%5Cn%22 //%0A        + %22B%22 //%0A    , n.asString());%0A  %7D%0A%0A  public void testReplaceInOrder1() %7B%0A    final RegexFindReplace%5B%5D repl = %7B//%0A            new RegexFindReplace(%22(GWTEXPUI-(%5C%5Cd+))%22,%0A                %22%3Ca href=%5C%22gwtexpui-bug?$2%5C%22%3E$1%3C/a%3E%22), //%0A            new RegexFindReplace(%22(issue%5C%5Cs+(%5C%5Cd+))%22,%0A                %22%3Ca href=%5C%22generic-bug?$2%5C%22%3E$1%3C/a%3E%22), //%0A        %7D;%0A    final SafeHtml o = html(%22A%5Cnissue 42%5CnReally GWTEXPUI-9918 is better%5CnB%22);%0A    final SafeHtml n = o.replaceAll(Arrays.asList(repl));%0A    assertNotSame(o, n);%0A    assertEquals(%22A%5Cn%22 //%0A        + %22%3Ca href=%5C%22generic-bug?42%5C%22%3Eissue 42%3C/a%3E%5Cn%22 //%0A        + %22Really %3Ca href=%5C%22gwtexpui-bug?9918%5C%22%3EGWTEXPUI-9918%3C/a%3E is better%5Cn%22%0A        + %22B%22 //%0A    , n.asString());%0A  %7D%0A%0A  private static SafeHtml html(String text) %7B%0A    return new SafeHtmlBuilder().append(text).toSafeHtml();%0A  %7D%0A%7D%0A

Add tests for SafeHtml.replaceAll(RegexFindReplace)