harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r901104 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/
Date Wed, 20 Jan 2010 08:41:48 GMT
Author: regisxu
Date: Wed Jan 20 08:41:27 2010
New Revision: 901104

URL: http://svn.apache.org/viewvc?rev=901104&view=rev
Log:
Apply patch for HARMONY-6426 (with minor changes): [test] Improve the method coverage rate
of unit test for java.lang.reflect

Added:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/InvocationTargetExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ModifierTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java?rev=901104&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
Wed Jan 20 08:41:27 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.harmony.luni.tests.java.lang.reflect;
+
+import java.lang.reflect.GenericSignatureFormatError;
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class GenericSignatureFormatErrorTest extends TestCase {
+
+    /**
+     * @tests java.lang.reflect.GenericSignatureFormatError#
+     *        GenericSignatureFormatError()
+     */
+    @Test
+    public void test_GenericSignatureFormatError() {
+        GenericSignatureFormatError e = new GenericSignatureFormatError();
+        assertNotNull(e);
+        assertNull(e.getMessage());
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/GenericSignatureFormatErrorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/InvocationTargetExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/InvocationTargetExceptionTest.java?rev=901104&r1=901103&r2=901104&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/InvocationTargetExceptionTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/InvocationTargetExceptionTest.java
Wed Jan 20 08:41:27 2010
@@ -17,6 +17,9 @@
 
 package org.apache.harmony.luni.tests.java.lang.reflect;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 import java.io.ByteArrayOutputStream;
 import java.io.CharArrayWriter;
 import java.io.PrintStream;
@@ -24,6 +27,8 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import org.junit.Test;
+
 public class InvocationTargetExceptionTest extends junit.framework.TestCase {
 
 	static class TestMethod {
@@ -240,6 +245,36 @@
                                 && s.length() > 400);
 	}
 
+    /**
+     * Test method for
+     * {@link java.lang.reflect.InvocationTargetException#InvocationTargetException(java.lang.Throwable,
java.lang.String)}
+     *
+     */
+    @Test
+    public void testInvocationTargetExceptionThrowableString() {
+        Exception cause = null;
+        InvocationTargetException e = new InvocationTargetException(cause,
+                "SomeMessage");
+        assertNull(e.getCause());
+        assertEquals("Wrong Message", "SomeMessage", e.getMessage());
+    }
+
+    class MyInvocationTargetException extends InvocationTargetException {
+        private static final long serialVersionUID = 1L;
+    }
+
+    /**
+     * Test method for
+     * {@link java.lang.reflect.InvocationTargetException#InvocationTargetException()}
+     *
+     */
+    @Test
+    public void testInvocationTargetException() {
+        InvocationTargetException e = new MyInvocationTargetException();
+        assertNull(e.getCause());
+    }
+
+
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java?rev=901104&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
Wed Jan 20 08:41:27 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.harmony.luni.tests.java.lang.reflect;
+
+import java.lang.reflect.MalformedParameterizedTypeException;
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class MalformedParameterizedTypeExceptionTest extends TestCase {
+
+    /**
+     * @tests java.lang.reflect.MalformedParameterizedTypeException#
+     *        MalformedParameterizedTypeException()
+     */
+    @Test
+    public void testMalformedParameterizedTypeException() {
+        MalformedParameterizedTypeException e = new MalformedParameterizedTypeException();
+        assertNotNull(e);
+        assertNull(e.getMessage());
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/MalformedParameterizedTypeExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ModifierTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ModifierTest.java?rev=901104&r1=901103&r2=901104&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ModifierTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ModifierTest.java
Wed Jan 20 08:41:27 2010
@@ -28,7 +28,7 @@
 	 */
 	public void test_Constructor() {
 		// Test for method java.lang.reflect.Modifier()
-		// Does nothing
+		new Modifier();
 	}
 
 	/**
@@ -182,6 +182,12 @@
 						java.lang.reflect.Modifier.PUBLIC
 								+ java.lang.reflect.Modifier.ABSTRACT).equals(
 						"public abstract"));
+
+        int i = 0xFFF;
+        String modification = "public protected private abstract static final transient "
+                + "volatile synchronized native strictfp interface";
+        assertTrue("Returned incorrect string value", Modifier.toString(i)
+                .equals(modification));
 	}
 
     public void test_Constants_Value() {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java?rev=901104&r1=901103&r2=901104&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/ProxyTest.java
Wed Jan 20 08:41:27 2010
@@ -287,6 +287,16 @@
 
     }
 
+    class MyProxy extends Proxy{
+        private static final long serialVersionUID = 1L;
+
+        protected MyProxy(InvocationHandler h) {
+            super(h);
+        }
+    }
+
+
+
 	protected void setUp() {
 	}
 

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java?rev=901104&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java
Wed Jan 20 08:41:27 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.harmony.luni.tests.java.lang.reflect;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+public class UndeclaredThrowableExceptionTest extends TestCase {
+
+    /**
+     * @tests {@link java.lang.reflect.UndeclaredThrowableException#UndeclaredThrowableException(java.lang.Throwable)}
+     *
+     */
+    @Test
+    public void test_UndeclaredThrowableException_LThrowable() {
+        UndeclaredThrowableException e = new UndeclaredThrowableException(
+                (Exception) null);
+        assertNotNull(e);
+        assertNull(e.getCause());
+
+    }
+
+    /**
+     * @tests {@link java.lang.reflect.UndeclaredThrowableException#UndeclaredThrowableException(java.lang.Throwable,
java.lang.String)}
+     *
+     */
+    @Test
+    public void test_UndeclaredThrowableException_LThrowable_LString() {
+        UndeclaredThrowableException e = new UndeclaredThrowableException(null,
+                "SomeMsg");
+        assertNotNull(e);
+        assertNull(e.getCause());
+        assertEquals("Wrong message", "SomeMsg", e.getMessage());
+    }
+
+    /**
+     * @tests {@link java.lang.reflect.UndeclaredThrowableException#getUndeclaredThrowable()}
+     */
+    @Test
+    public void test_getUndeclaredThrowable() {
+        UndeclaredThrowableException e = new UndeclaredThrowableException(null);
+        assertNotNull(e);
+        assertNull(e.getUndeclaredThrowable());
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/reflect/UndeclaredThrowableExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message