From cec4dd4b1d33f78997603d0f89c0d0e56e64dbcd Mon Sep 17 00:00:00 2001 From: Peter Hallam Date: Mon, 26 Apr 2010 12:53:37 -0700 Subject: merge more modules into luni --- .../tests/java/lang/annotation/AllTests.java | 41 -- .../lang/annotation/AnnotationFormatErrorTest.java | 56 --- .../tests/java/lang/annotation/AnnotationTest.java | 431 --------------------- .../AnnotationTypeMismatchExceptionTest.java | 46 --- .../java/lang/annotation/ElementTypeTest.java | 65 ---- .../IncompleteAnnotationExceptionTest.java | 58 --- .../java/lang/annotation/RetentionPolicyTest.java | 60 --- .../java/lang/annotation/TestAnnotation1.java | 25 -- .../java/lang/annotation/TestAnnotation2.java | 15 - .../java/lang/annotation/TestAnnotation3.java | 28 -- .../java/lang/annotation/TestAnnotation3b.java | 28 -- .../java/lang/annotation/TestAnnotation4.java | 12 - .../tests/java/lang/annotation/TestEnum1.java | 5 - .../tests/java/lang/annotation/TestEnum1b.java | 5 - .../src/test/java/tests/annotation/AllTests.java | 33 -- 15 files changed, 908 deletions(-) delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java delete mode 100644 annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java delete mode 100644 annotation/src/test/java/tests/annotation/AllTests.java (limited to 'annotation/src/test/java') diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java deleted file mode 100644 index c2b179e..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AllTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* 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.annotation.tests.java.lang.annotation; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite for java.nio.charset package. - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite("Test for java.lang.annotation"); - // $JUnit-BEGIN$ - - suite.addTestSuite(AnnotationTest.class); - suite.addTestSuite(AnnotationFormatErrorTest.class); - suite.addTestSuite(AnnotationTypeMismatchExceptionTest.class); - suite.addTestSuite(ElementTypeTest.class); - suite.addTestSuite(IncompleteAnnotationExceptionTest.class); - suite.addTestSuite(RetentionPolicyTest.class); - - // $JUnit-END$ - return suite; - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java deleted file mode 100644 index b80f3a9..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationFormatErrorTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import java.lang.annotation.AnnotationFormatError; - -import junit.framework.TestCase; - -/** - * Test case of java.lang.annotation.AnnotationFormatError - */ -public class AnnotationFormatErrorTest extends TestCase { - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(String) - */ - @SuppressWarnings("nls") - public void test_constructorLjava_lang_String() { - AnnotationFormatError e = new AnnotationFormatError("some message"); - assertEquals("some message", e.getMessage()); - } - - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(Throwable) - */ - public void test_constructorLjava_lang_Throwable() { - IllegalArgumentException iae = new IllegalArgumentException(); - AnnotationFormatError e = new AnnotationFormatError(iae); - assertSame(iae, e.getCause()); - } - - /** - * @tests java.lang.annotation.AnnotationFormatError#AnnotationFormatError(String,Throwable) - */ - @SuppressWarnings("nls") - public void test_constructorLjava_lang_StringLjava_lang_Throwable() { - IllegalArgumentException iae = new IllegalArgumentException(); - AnnotationFormatError e = new AnnotationFormatError("some message", iae); - assertEquals("some message", e.getMessage()); - assertSame(iae, e.getCause()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java deleted file mode 100644 index e9657de..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTest.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import junit.framework.TestCase; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Test case of java.lang.annotation.Annotation - */ -public class AnnotationTest extends TestCase { - - public void test_annotationType() { - Annotation [] annotations = AnnotatedClass.class.getDeclaredAnnotations(); - assertEquals(1, annotations.length); - Annotation anno = annotations[0]; - assertEquals(TestAnnotation1.class, anno.annotationType()); - } - - public void test_equals() throws Exception { - // test type - Method m1 = AnnotatedClass2.class - .getDeclaredMethod("a", new Class[] {}); - Method m2 = AnnotatedClass2.class - .getDeclaredMethod("b", new Class[] {}); - assertFalse("other annotation class type", - m1.getDeclaredAnnotations()[0].equals(m2 - .getDeclaredAnnotations()[0])); - - // test equality / non equality for base types and compound types - List methods = Arrays.asList(AnnotatedClass.class.getDeclaredMethods()); - Map> eqs = new HashMap>(); - Map> neqs = new HashMap>(); - for (Method m : methods) { - String name = m.getName(); - //System.out.println("name "+name); - Map> curT = name.charAt(0) == 'e'? eqs : neqs; - String testNum = name.substring(1,3); // 01 - List mlist = curT.get(testNum); - if (mlist == null) { - mlist = new ArrayList(); - curT.put(testNum, mlist); - } - mlist.add(AnnotatedClass.class.getDeclaredMethod(name, new Class[] {})); - } - - for (List eqList : eqs.values()) { - for (int i = 0; i < eqList.size() -1; i++) { - for (int j = i+1; j < eqList.size(); j++) { - Method me1 = eqList.get(i); - Method me2 = eqList.get(j); - //System.out.println("eq test for "+me1.getName()+", "+me2.getName()); - Annotation a1 = me1.getDeclaredAnnotations()[0]; - Annotation a2 = me2.getDeclaredAnnotations()[0]; - assertEquals("must be equal : method1:"+me1.getName()+", method2: "+me2.getName(), a1, a2); - assertEquals("same hashcode", a1.hashCode(), a2.hashCode()); - } - } - } - - for (List eqList : neqs.values()) { - for (int i = 0; i < eqList.size() -1; i++) { - for (int j = i+1; j < eqList.size(); j++) { - Method me1 = eqList.get(i); - Method me2 = eqList.get(j); - Annotation a1 = me1.getDeclaredAnnotations()[0]; - Annotation a2 = me2.getDeclaredAnnotations()[0]; - //System.out.println("ne test for "+me1.getName()+", "+me2.getName()); - assertFalse("must not be equal : method1:"+me1.getName()+", method2: "+me2.getName(), - a1.equals(a2)); - if (a1.hashCode() != a2.hashCode()) { - assertFalse("not same hashcode -> not equals", a1.equals(a2)); - } - } - - } - } - } - - public void test_hashCode() throws SecurityException, NoSuchMethodException { - Annotation a1 = AnnotatedClass.class.getDeclaredAnnotations()[0]; - assertEquals(a1.hashCode(), (127 * "value".hashCode() ^ "foobar".hashCode())); - // i+= 127 *(key.hashCode() ^ memberValHashCode(value); - - Method m1 = AnnotatedClass.class.getDeclaredMethod("e34c", new Class[] {}); - int arrHc = Arrays.hashCode(new Object[]{}); - /* - TestAnnotation3[] arrAnno() default {}; - String[] arrString() default {}; - Class[] arrClass() default {}; - TestEnum1[] arrEnum() default {}; - */ - assertEquals( - (127 * "arrAnno".hashCode() ^ arrHc) + - (127 * "arrString".hashCode() ^ arrHc)+ - (127 * "arrClass".hashCode() ^ arrHc) + - (127 * "arrEnum".hashCode() ^ arrHc) - , - m1.getDeclaredAnnotations()[0].hashCode()); - - Method m2 = AnnotatedClass3.class.getDeclaredMethod("a", new Class[] {}); - assertEquals( - (127 * "i".hashCode() ^ 12345), - m2.getDeclaredAnnotations()[0].hashCode()); - - } -} - -class AnnotatedClass2 { - @TestAnnotation3() - void a() {} - @TestAnnotation3b() - void b() {} -} - -class AnnotatedClass3 { - @TestAnnotation4(i = 12345) - void a() {} -} - -@TestAnnotation1("foobar") -class AnnotatedClass { - - // ----- boolean ----- - @TestAnnotation3(z = false) - void e01a() {} - @TestAnnotation3(z = false) - void e01b() {} - @TestAnnotation3() - void e01c() {} - - @TestAnnotation3(z = true) - void e02a() {} - @TestAnnotation3(z = true) - void e02b() {} - - @TestAnnotation3(z = false) - void n03a() {} - @TestAnnotation3(z = true) - void n03b() {} - - - // ----- byte ----- - @TestAnnotation3(b = 0) - void e04a() {} - @TestAnnotation3(b = 0) - void e04b() {} - @TestAnnotation3() - void e04c() {} - - @TestAnnotation3(b= 127) - void e05a() {} - @TestAnnotation3(b = 127) - void e05b() {} - - @TestAnnotation3(b = -128) - void n06a() {} - @TestAnnotation3(b = 127) - void n06b() {} - - - // ----- short ----- - @TestAnnotation3(s = 0) - void e07a() {} - @TestAnnotation3(s = 0) - void e07b() {} - @TestAnnotation3() - void e07c() {} - - @TestAnnotation3(s= 32767) - void e08a() {} - @TestAnnotation3(s = 32767) - void e08b() {} - - @TestAnnotation3(s = -32768) - void n09a() {} - @TestAnnotation3(s = 32767) - void n09b() {} - - - // ----- int ----- - @TestAnnotation3(i = 100) - void e10a() {} - @TestAnnotation3(i = 100) - void e10b() {} - @TestAnnotation3() - void e10c() {} - - @TestAnnotation3(i = Integer.MAX_VALUE) - void e11a() {} - @TestAnnotation3(i = Integer.MAX_VALUE) - void e11b() {} - - @TestAnnotation3(i = Integer.MAX_VALUE) - void n12a() {} - @TestAnnotation3(i = Integer.MIN_VALUE) - void n12b() {} - - - // ----- long ----- - @TestAnnotation3(j = 0) - void e13a() {} - @TestAnnotation3(j = 0) - void e13b() {} - @TestAnnotation3() - void e13c() {} - - @TestAnnotation3(j = Long.MAX_VALUE) - void e14a() {} - @TestAnnotation3(j = Long.MAX_VALUE) - void e14b() {} - - @TestAnnotation3(j = Long.MAX_VALUE) - void n15a() {} - @TestAnnotation3(j = Long.MIN_VALUE) - void n15b() {} - - - // ----- float ----- - @TestAnnotation3(f = 0.0f) - void e16a() {} - @TestAnnotation3(f = 0.0f) - void e16b() {} - @TestAnnotation3() - void e16c() {} - - @TestAnnotation3(f = Float.MAX_VALUE) - void e17a() {} - @TestAnnotation3(f = Float.MAX_VALUE) - void e17b() {} - - @TestAnnotation3(f = Float.NaN) - void e18a() {} - @TestAnnotation3(f = Float.NaN) - void e18b() {} - - @TestAnnotation3(f = Long.MAX_VALUE) - void n19a() {} - @TestAnnotation3(f = Long.MIN_VALUE) - void n19b() {} - - @TestAnnotation3(f = 0.0f) - void n20a() {} - @TestAnnotation3(f = -0.0f) - void n20b() {} - - - // ----- double ----- - @TestAnnotation3(d = 0.0d) - void e21a() {} - @TestAnnotation3(d = 0.0d) - void e21b() {} - @TestAnnotation3() - void e21c() {} - - @TestAnnotation3(d = Double.MAX_VALUE) - void e22a() {} - @TestAnnotation3(d = Double.MAX_VALUE) - void e22b() {} - - @TestAnnotation3(d = Double.NaN) - void e23a() {} - @TestAnnotation3(d = Double.NaN) - void e23b() {} - - - @TestAnnotation3(d = Double.MAX_VALUE) - void n24a() {} - @TestAnnotation3(d = Double.MIN_VALUE) - void n24b() {} - - @TestAnnotation3(d = 0.0d) - void n25a() {} - @TestAnnotation3(d = -0.0d) - void n25b() {} - - - // ----- String ----- - @TestAnnotation3(aString = "") - void e26a() {} - @TestAnnotation3(aString = "") - void e26b() {} - @TestAnnotation3() - void e26c() {} - - @TestAnnotation3(aString = "asjdfk jkls dfjklsd fklsd jklds kflds jfkldsfjd"+"d") - void e27a() {} - @TestAnnotation3(aString = "asjdfk jkls dfjklsd fklsd jklds kflds jfkldsfj"+"dd") - void e27b() {} - - @TestAnnotation3(aString = "a") - void n28a() {} - @TestAnnotation3(aString = "b") - void n28b() {} - - - // ----- Class----- - @TestAnnotation3(aClazz = Void.class) - void e29a() {} - @TestAnnotation3(aClazz = Void.class) - void e29b() {} - @TestAnnotation3() - void e29c() {} - - @TestAnnotation3(aClazz = Integer.class) - void n30a() {} - @TestAnnotation3(aClazz = int.class) - void n30b() {} - - - // ----- Enum----- - @TestAnnotation3(aEnum = TestEnum1.F) - void e31a() {} - @TestAnnotation3(aEnum = TestEnum1.F) - void e31b() {} - @TestAnnotation3() - void e31c() {} - - @TestAnnotation3(aEnum = TestEnum1.F) - void n32a() {} - @TestAnnotation3(aEnum = TestEnum1.A) - void n32b() {} - - @TestAnnotation3(aEnum = TestEnum1.F) - void n33a() {} - @TestAnnotation3(aEnum = TestEnum1.L) - void n33b() {} - - - // ----- String arr----- - @TestAnnotation2(arrString = {}) - void e34a() {} - @TestAnnotation2(arrString = {}) - void e34b() {} - @TestAnnotation2(arrString = {}) - void e34c() {} - - @TestAnnotation2(arrString = { "a", "b"}) - void e35a() {} - @TestAnnotation2(arrString = { "a", "b" }) - void e35b() {} - - @TestAnnotation2(arrString = { "a", "b"}) - void n36a() {} - @TestAnnotation2(arrString = { "a", "c" }) - void n36b() {} - - - // ----- Class arr----- - @TestAnnotation2(arrClass= {}) - void e37a() {} - @TestAnnotation2(arrClass = {}) - void e37b() {} - @TestAnnotation2(arrClass = {}) - void e37c() {} - - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void e38a() {} - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void e38b() {} - - @TestAnnotation2(arrClass = { Void.class, Integer.class}) - void n39a() {} - @TestAnnotation2(arrClass = { Void.class, int.class}) - void n39b() {} - - // ----- Enum arr----- - @TestAnnotation2(arrEnum= {}) - void e40a() {} - @TestAnnotation2(arrEnum = {}) - void e40b() {} - @TestAnnotation2(arrEnum = {}) - void e40c() {} - - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void e41a() {} - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void e41b() {} - - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.F }) - void n42a() {} - @TestAnnotation2(arrEnum = { TestEnum1.A, TestEnum1.L }) - void n42b() {} - - - // ----- Annotation arr----- - @TestAnnotation2(arrAnno= {}) - void e43a() {} - @TestAnnotation2(arrAnno = {}) - void e43b() {} - @TestAnnotation2() - void e43c() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void e44a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void e44b() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void n45a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 124)}) - void n45b() {} - - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = 20), @TestAnnotation3(j = 123)}) - void n46a() {} - @TestAnnotation2(arrAnno = { @TestAnnotation3(i = -20), @TestAnnotation3(j = 123)}) - void n46b() {} - -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java deleted file mode 100644 index 37ee8c1..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/AnnotationTypeMismatchExceptionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.reflect.Method; - -import junit.framework.TestCase; - -/** - * Test case of java.lang.annotation.AnnotationTypeMismatchException - */ -public class AnnotationTypeMismatchExceptionTest extends TestCase { - - /** - * @throws ClassNotFoundException - * @throws SecurityException - * @tests java.lang.annotation.AnnotationTypeMismatchException#AnnotationTypeMismatchException(Method, - * String) - */ - @SuppressWarnings("nls") - public void test_constructorLjava_lang_reflect_MethodLjava_lang_String() throws SecurityException, ClassNotFoundException { - Method[] methods = Class.forName("java.lang.String").getMethods(); - Method m = methods[0]; - AnnotationTypeMismatchException e = new AnnotationTypeMismatchException( - m, "some type"); - assertNotNull("can not instantiate AnnotationTypeMismatchException", e); - assertSame("wrong method name", m, e.element()); - assertEquals("wrong found type", "some type", e.foundType()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java deleted file mode 100644 index d81cabd..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/ElementTypeTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.util.Arrays; - -import junit.framework.TestCase; - -/** - * Test case of java.lang.annotation.ElementType - */ -public class ElementTypeTest extends TestCase { - - /** - * @throws Exception - * @tests java.lang.annotation.ElementType#valueOf(String) - */ - @SuppressWarnings("nls") - public void test_valueOfLjava_lang_String() throws Exception { - assertSame(ElementType.ANNOTATION_TYPE, ElementType - .valueOf("ANNOTATION_TYPE")); - assertSame(ElementType.CONSTRUCTOR, ElementType.valueOf("CONSTRUCTOR")); - assertSame(ElementType.FIELD, ElementType.valueOf("FIELD")); - assertSame(ElementType.LOCAL_VARIABLE, ElementType - .valueOf("LOCAL_VARIABLE")); - assertSame(ElementType.METHOD, ElementType.valueOf("METHOD")); - assertSame(ElementType.PACKAGE, ElementType.valueOf("PACKAGE")); - assertSame(ElementType.PARAMETER, ElementType.valueOf("PARAMETER")); - assertSame(ElementType.TYPE, ElementType.valueOf("TYPE")); - try { - ElementType.valueOf("OTHER"); - fail("Should throw an IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.ElementType#values() - */ - @SuppressWarnings("nls") - public void test_values() throws Exception { - ElementType[] values = ElementType.values(); - assertTrue(values.length > 1); - Arrays.sort(values); - assertTrue(Arrays.binarySearch(values, ElementType.METHOD) >= 0); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java deleted file mode 100644 index d44b90a..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/IncompleteAnnotationExceptionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import java.lang.annotation.IncompleteAnnotationException; - -import junit.framework.TestCase; - -/** - * - */ -public class IncompleteAnnotationExceptionTest extends TestCase { - - /* - * Class under test for void IncompleteAnnotationException(String) - * Regression for HARMONY-2477 - */ - public void testNullType() { - try { - new IncompleteAnnotationException(null, "str"); - fail("NullPointerException must be thrown"); - } catch (NullPointerException e) { - // Expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.IncompleteAnnotationException#IncompleteAnnotationException(Class, - * String) - */ - @SuppressWarnings("nls") - public void test_constructorLjava_lang_Class_Ljava_lang_String() - throws Exception { - Class clazz = String.class; - String elementName = "some element"; - IncompleteAnnotationException e = new IncompleteAnnotationException( - clazz, elementName); - assertNotNull("can not instantiate IncompleteAnnotationException", e); - assertSame("wrong annotation type", clazz, e.annotationType()); - assertSame("wrong element name", elementName, e.elementName()); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java deleted file mode 100644 index c4f7c03..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/RetentionPolicyTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.annotation.tests.java.lang.annotation; - -import java.lang.annotation.RetentionPolicy; -import java.util.Arrays; - -import junit.framework.TestCase; - -/** - * Test case of java.lang.annotation.RetentionPolicy - */ -public class RetentionPolicyTest extends TestCase { - /** - * @throws Exception - * @tests java.lang.annotation.RetentionPolicy#valueOf(String) - */ - @SuppressWarnings("nls") - public void test_valueOfLjava_lang_String() throws Exception { - assertSame(RetentionPolicy.CLASS, RetentionPolicy - .valueOf("CLASS")); - assertSame(RetentionPolicy.RUNTIME, RetentionPolicy - .valueOf("RUNTIME")); - assertSame(RetentionPolicy.SOURCE, RetentionPolicy - .valueOf("SOURCE")); - try { - RetentionPolicy.valueOf("OTHER"); - fail("Should throw an IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - /** - * @throws Exception - * @tests java.lang.annotation.RetentionPolicy#values() - */ - @SuppressWarnings("nls") - public void test_values() throws Exception { - RetentionPolicy[] values = RetentionPolicy.values(); - assertTrue(values.length > 1); - Arrays.sort(values); - assertTrue(Arrays.binarySearch(values, RetentionPolicy.RUNTIME) >= 0); - } -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java deleted file mode 100644 index 64393ef..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation1.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * 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.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface TestAnnotation1 { - String value(); -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java deleted file mode 100644 index d3c7d42..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation2.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation2 { - TestAnnotation3[] arrAnno() default {}; - String[] arrString() default {}; - Class[] arrClass() default {}; - TestEnum1[] arrEnum() default {}; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java deleted file mode 100644 index 3228c66..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation3 { - /* - * only primitive type, String, Class, annotation, - * enumeration are permitted - * or 1-dimensional arrays thereof - */ - boolean z() default false; - byte b() default 0; - short s() default 0; - int i() default 100; - long j() default 0; - - float f() default 0.0f; - double d() default 0.0d; - - String aString() default ""; - Class aClazz() default Void.class; - TestEnum1 aEnum() default TestEnum1.F; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java deleted file mode 100644 index 5411011..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation3b.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation3b { - /* - * only primitive type, String, Class, annotation, - * enumeration are permitted - * or 1-dimensional arrays thereof - */ - boolean z() default false; - byte b() default 0; - short s() default 0; - int i() default 100; - long l() default 0; - - float f() default 0.0f; - double d() default 0.0d; - - String aString() default ""; - Class aClazz() default Void.class; - TestEnum1 aEnum() default TestEnum1.F; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java deleted file mode 100644 index 2267536..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestAnnotation4.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target( {ElementType.METHOD}) -public @interface TestAnnotation4 { - int i() default 0; -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java deleted file mode 100644 index f8ed73d..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -public enum TestEnum1 { - Z, F, L, A, B -} diff --git a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java b/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java deleted file mode 100644 index 874d893..0000000 --- a/annotation/src/test/java/org/apache/harmony/annotation/tests/java/lang/annotation/TestEnum1b.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.apache.harmony.annotation.tests.java.lang.annotation; - -public enum TestEnum1b { - Z, F, L, A, B -} diff --git a/annotation/src/test/java/tests/annotation/AllTests.java b/annotation/src/test/java/tests/annotation/AllTests.java deleted file mode 100644 index c95fe26..0000000 --- a/annotation/src/test/java/tests/annotation/AllTests.java +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 tests.annotation; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Test suite that includes all tests for the NIO_Char project. - */ -public class AllTests { - public static Test suite() { - TestSuite suite = new TestSuite("All Annotation test suites"); - // $JUnit-BEGIN$ - suite.addTest(org.apache.harmony.annotation.tests.java.lang.annotation.AllTests.suite()); - // $JUnit-END$ - return suite; - } -} -- cgit v1.1