Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

General improvement of test code coverage.

  • Loading branch information...
commit de9b9f553f8e54018762e55274b791f009d409f3 1 parent 32e8393
@rolfl rolfl authored
View
11 test/src/java/org/jdom2/test/cases/util/TestReflectionConstructor.java
@@ -7,6 +7,7 @@
import org.junit.Test;
+import org.jdom2.Element;
import org.jdom2.Namespace;
import org.jdom2.internal.ReflectionConstructor;
@@ -48,4 +49,14 @@ public void testConstructNoaccessConstructor() {
checkException(IllegalArgumentException.class, e);
}
}
+
+ @Test
+ public void testConstructClassCastConstructor() {
+ try {
+ ReflectionConstructor.construct("java.lang.String", Namespace.class);
+ failNoException(ClassCastException.class);
+ } catch (Exception e) {
+ checkException(ClassCastException.class, e);
+ }
+ }
}
View
18 test/src/java/org/jdom2/test/cases/xpath/AbstractTestXPathCompiled.java
@@ -58,6 +58,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.jdom2.test.util.UnitTestUtil.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -559,6 +560,23 @@ public void testBadVariableName2() {
}
@Test
+ public void testBadVariableName3() {
+ XPathExpression<Element> xpe = getFactory().compile("/", Filters.element());
+ try {
+ xpe.getVariable(null);
+ failNoException(NullPointerException.class);
+ } catch (Exception e) {
+ checkException(NullPointerException.class, e);
+ }
+ try {
+ xpe.setVariable(null, "hi");
+ failNoException(NullPointerException.class);
+ } catch (Exception e) {
+ checkException(NullPointerException.class, e);
+ }
+ }
+
+ @Test
public void testBadVariableNamespace() {
try {
Map<String,Object> vars = new HashMap<String, Object>();
Please sign in to comment.
Something went wrong with that request. Please try again.