Add JUnit test for RegexFindReplace
This test is really trivial, it only validates the container class
holds data. We'll come back later and add additional tests against
the SafeHtml.replaceAll method which uses it.
Change-Id: Ie21e4d60de1e4464a5c57de27e1edc3a145f6cd6
Reviewed-by: Brad Larson <bklarson@gmail.com>
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/pom.xml b/pom.xml
index c8025bc..197ac60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -287,6 +287,13 @@
</build>
<dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
diff --git a/src/test/java/com/google/gwtexpui/safehtml/client/RegexFindReplaceTest.java b/src/test/java/com/google/gwtexpui/safehtml/client/RegexFindReplaceTest.java
new file mode 100644
index 0000000..a11a7ec
--- /dev/null
+++ b/src/test/java/com/google/gwtexpui/safehtml/client/RegexFindReplaceTest.java
@@ -0,0 +1,28 @@
+// Copyright (C) 2009 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 com.google.gwtexpui.safehtml.client;
+
+import junit.framework.TestCase;
+
+public class RegexFindReplaceTest extends TestCase {
+ public void testCreate() {
+ final String find = "find";
+ final String replace = "replace";
+ final RegexFindReplace a = new RegexFindReplace(find, replace);
+ assertSame(find, a.find());
+ assertSame(replace, a.replace());
+ assertEquals("find = " + find + ", replace = " + replace, a.toString());
+ }
+}