harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r901094 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/
Date Wed, 20 Jan 2010 07:51:58 GMT
Author: regisxu
Date: Wed Jan 20 07:51:39 2010
New Revision: 901094

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

Added:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassCircularityErrorTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassFormatErrorTest.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedClassVersionErrorTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassCircularityErrorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassCircularityErrorTest.java?rev=901094&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassCircularityErrorTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassCircularityErrorTest.java
Wed Jan 20 07:51:39 2010
@@ -0,0 +1,42 @@
+/* 
+ * 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;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class ClassCircularityErrorTest {
+    // Thrown when a circularity has been detected while initializing a class.
+    /**
+     * @tests java.lang.ClassCircularityError#ClassCircularityError()
+     */
+    @Test
+    public void test_ClassCircularityError() {
+        new ClassCircularityError();
+    }
+
+    /**
+     * @tests java.lang.ClassCircularityError#ClassCircularityError(java.lang.String)
+     */
+    @Test
+    public void test_ClassCircularityError_LString() {
+        ClassCircularityError e = new ClassCircularityError(
+                "Some Error message");
+        assertEquals("Wrong message", "Some Error message", e.getMessage());
+    }
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassFormatErrorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassFormatErrorTest.java?rev=901094&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassFormatErrorTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassFormatErrorTest.java
Wed Jan 20 07:51:39 2010
@@ -0,0 +1,46 @@
+/* 
+ * 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;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class ClassFormatErrorTest {
+    /**
+     * Thrown when the Java Virtual Machine attempts to read a class file and
+     * determines that the file is malformed or otherwise cannot be interpreted
+     * as a class file.
+     */
+
+    /**
+     * @tests java.lang.ClassFormatError#ClassFormatError()
+     */
+    @Test
+    public void test_ClassFormatError() {
+        new ClassFormatError();
+    }
+
+    /**
+     * @tests java.lang.ClassFormatError#ClassFormatError(java.lang.String)
+     */
+    @Test
+    public void test_ClassFormatError_LString() {
+        ClassFormatError e = new ClassFormatError("Some Error Message");
+        assertEquals("Wrong message", "Some Error Message", e.getMessage());
+    }
+
+}

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java?rev=901094&r1=901093&r2=901094&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ClassNotFoundExceptionTest.java
Wed Jan 20 07:51:39 2010
@@ -17,9 +17,15 @@
 
 package org.apache.harmony.luni.tests.java.lang;
 
+import java.io.IOException;
+
 import junit.framework.TestCase;
 
 public class ClassNotFoundExceptionTest extends TestCase {
+    /**
+     * Thrown when an application tries to load in a class through its string
+     * name using the forName method in class Class.
+     */
 
 	/**
 	 * @tests java.lang.ClassNotFoundException#ClassNotFoundException()
@@ -39,4 +45,16 @@
         assertEquals("fixture", e.getMessage());
         assertNull(e.getCause());
 	}
+	
+    /**
+     * @tests java.lang.ClassNotFoundException#ClassNotFoundException(java.lang.String, java.lang.Throwable)
+     */
+    public void test_ClassNotFoundException_LString_LThrowable() {
+        IOException in = new IOException();
+        ClassNotFoundException e = new ClassNotFoundException("SomeMessage", in);
+        assertEquals("Wrong Exception", in, e.getException());
+        assertEquals("Wrong message", "SomeMessage", e.getMessage());
+        assertEquals("Wrong cause", in, e.getCause());
+    }
+
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java?rev=901094&r1=901093&r2=901094&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java
Wed Jan 20 07:51:39 2010
@@ -293,7 +293,7 @@
     /**
      * @tests java.lang.String.offsetByCodePoints(int, int)'
      */
-    public void test_offsetByCodePointsII() throws Exception {
+    public void test_offsetByCodePoints_II() throws Exception {
         int result = new String("a\uD800\uDC00b").offsetByCodePoints(0, 2);
         assertEquals(3, result);
 

Added: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedClassVersionErrorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedClassVersionErrorTest.java?rev=901094&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedClassVersionErrorTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedClassVersionErrorTest.java
Wed Jan 20 07:51:39 2010
@@ -0,0 +1,49 @@
+/* 
+ * 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;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class UnsupportedClassVersionErrorTest {
+    /**
+     * Thrown when the Java Virtual Machine attempts to read a class file and
+     * determines that the major and minor version numbers in the file are not
+     * supported.
+     */
+
+    /**
+     * @tests java.lang.UnsupportedClassVersionError#UnsupportedClassVersionError()
+     */
+    @Test
+    public void test_UnsupportedClassVersionError() {
+        UnsupportedClassVersionError error = new UnsupportedClassVersionError();
+        assertNotNull(error);
+        assertNull(error.getMessage());
+    }
+
+    /**
+     *@tests java.lang.UnsupportedClassVersionError#UnsupportedClassVersionError(java.lang.String)
+     */
+    @Test
+    public void test_UnsupportedClassVersionError_LString() {
+        UnsupportedClassVersionError e = new UnsupportedClassVersionError(
+                "Some Error Message");
+        assertEquals("Wrong message", "Some Error Message", e.getMessage());
+    }
+
+}

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



Mime
View raw message