Author: scottbw
Date: Fri Apr 9 14:00:37 2010
New Revision: 932419
URL: http://svn.apache.org/viewvc?rev=932419&view=rev
Log:
Added some more test cases for the parser utils
Added:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/NumberUtilsTest.java
Modified:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/IRIValidatorTest.java
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
Modified:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/IRIValidatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/IRIValidatorTest.java?rev=932419&r1=932418&r2=932419&view=diff
==============================================================================
---
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/IRIValidatorTest.java
(original)
+++
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/IRIValidatorTest.java
Fri Apr 9 14:00:37 2010
@@ -23,6 +23,12 @@ import org.junit.Test;
public class IRIValidatorTest {
@Test
+ public void classTest(){
+ @SuppressWarnings("unused")
+ IRIValidator validator = new IRIValidator();
+ }
+
+ @Test
public void url(){
assertTrue(IRIValidator.isValidIRI("http://incubator.apache.org"));
}
@@ -46,4 +52,8 @@ public class IRIValidatorTest {
public void utf8(){
assertTrue(IRIValidator.isValidIRI("http://××.××.××/××/××/××?××=סע;פץ=קר#שת"));
}
+ @Test
+ public void badScheme(){
+ assertFalse(IRIValidator.isValidIRI(":FAIL"));
+ }
}
Modified:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java?rev=932419&r1=932418&r2=932419&view=diff
==============================================================================
---
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
(original)
+++
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/LocalizationUtilsTest.java
Fri Apr 9 14:00:37 2010
@@ -331,4 +331,21 @@ public class LocalizationUtilsTest {
assertFalse(LocalizationUtils.isValidLanguageTag(lang));
}
}
+
+ @Test
+ public void nullTest(){
+ assertFalse(LocalizationUtils.isValidLanguageTag(null));
+ }
+
+ @Test
+ public void emptyElementList(){
+ ILocalizedElement[] elements = elements(new String[0]);
+ assertNull(LocalizationUtils.getLocalizedElement(elements,
LANG_LIST_1));
+ }
+
+ @Test
+ public void classTest(){
+ @SuppressWarnings("unused")
+ LocalizationUtils utils = new LocalizationUtils();
+ }
}
Added:
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/NumberUtilsTest.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/NumberUtilsTest.java?rev=932419&view=auto
==============================================================================
---
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/NumberUtilsTest.java
(added)
+++
incubator/wookie/trunk/parser/java/src-test/org/apache/wookie/w3c/test/NumberUtilsTest.java
Fri Apr 9 14:00:37 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.wookie.w3c.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.apache.wookie.w3c.util.NumberUtils;
+
+public class NumberUtilsTest {
+
+ @Test
+ public void classTest(){
+ @SuppressWarnings("unused")
+ NumberUtils utils = new NumberUtils();
+ }
+
+ @Test(expected=NumberFormatException.class)
+ public void nullTest(){
+ NumberUtils.processNonNegativeInteger(null);
+ }
+
+ @Test
+ public void oddChars(){
+ assertEquals(100,
NumberUtils.processNonNegativeInteger("100a5"));
+ }
+}