commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r563161 - in /commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath: JXPathTestSuite.java ri/model/EmptyCollectionTest.java
Date Mon, 06 Aug 2007 14:58:18 GMT
Author: mbenson
Date: Mon Aug  6 07:58:18 2007
New Revision: 563161

URL: http://svn.apache.org/viewvc?view=rev&rev=563161
Log:
tests for [JXPATH-98]

Added:
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
  (with props)
Modified:
    commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/JXPathTestSuite.java

Modified: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/JXPathTestSuite.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/JXPathTestSuite.java?view=diff&rev=563161&r1=563160&r2=563161
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/JXPathTestSuite.java (original)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/JXPathTestSuite.java Mon
Aug  6 07:58:18 2007
@@ -29,6 +29,7 @@
 import org.apache.commons.jxpath.ri.compiler.CoreOperationTest;
 import org.apache.commons.jxpath.ri.compiler.ExtensionFunctionTest;
 import org.apache.commons.jxpath.ri.compiler.VariableTest;
+import org.apache.commons.jxpath.ri.model.EmptyCollectionTest;
 import org.apache.commons.jxpath.ri.model.ExternalXMLNamespaceTest;
 import org.apache.commons.jxpath.ri.model.MixedModelTest;
 import org.apache.commons.jxpath.ri.model.XMLPreserveSpaceTest;
@@ -85,6 +86,7 @@
         suite.addTestSuite(VariableTest.class);
         suite.addTestSuite(ContainerModelTest.class);
         suite.addTestSuite(BeanModelTest.class);
+        suite.addTestSuite(EmptyCollectionTest.class);
         suite.addTestSuite(DynamicPropertiesModelTest.class);
         suite.addTestSuite(DOMModelTest.class);
         suite.addTestSuite(DynaBeanModelTest.class);

Added: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java?view=auto&rev=563161
==============================================================================
--- commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
(added)
+++ commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
Mon Aug  6 07:58:18 2007
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ * The ASF licenses this file to You 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.commons.jxpath.ri.model;
+
+import java.util.Collections;
+
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.JXPathTestCase;
+
+/**
+ * Be sure empty lists/sets/arrays work.
+ * @author mbenson
+ * @version $Revision$ $Date$
+ */
+public class EmptyCollectionTest extends JXPathTestCase {
+    public static class HasChild {
+        private Object child;
+
+        /**
+         * Construct a new EmptyCollectionTest.HasChild instance.
+         */
+        public HasChild(Object child) {
+            this.child = child;
+        }
+
+        public Object getChild() {
+            return child;
+        }
+    }
+
+    /**
+     * Construct a new EmptyCollectionTest instance.
+     */
+    public EmptyCollectionTest(String s) {
+        super(s);
+    }
+
+    public void testEmptyList() {
+        assertXPathPointerIterator(JXPathContext.newContext(Collections.EMPTY_LIST), "/*",
+                Collections.EMPTY_LIST);
+    }
+
+    public void testEmptyArray() {
+        assertXPathPointerIterator(JXPathContext.newContext(new Object[0]), "/*", list());
+    }
+
+    public void testEmptySet() {
+        assertXPathPointerIterator(JXPathContext.newContext(Collections.EMPTY_SET), "/*",
+                Collections.EMPTY_SET);
+    }
+
+    public void testEmptyChildList() {
+        assertXPathPointerIterator(JXPathContext.newContext(new HasChild(Collections.EMPTY_LIST)),
+                "/child/*", Collections.EMPTY_LIST);
+    }
+
+    public void testEmptyChildArray() {
+        assertXPathPointerIterator(JXPathContext.newContext(new HasChild(new Object[0])),
+                "/child/*", list());
+    }
+
+    public void testEmptyChildSet() {
+        assertXPathPointerIterator(JXPathContext.newContext(new HasChild(Collections.EMPTY_SET)),
+                "/child/*", Collections.EMPTY_SET);
+    }
+}

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/model/EmptyCollectionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message