summaryrefslogtreecommitdiffstats
path: root/dalvik/src/test
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:50:54 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-09 17:50:54 -0800
commita0881d052ee72e3f7e773374e9b1aa75fbd6be4c (patch)
tree8a9462436077d0d906368cb21f521f1bf8a25500 /dalvik/src/test
parentdd828f42a5c83b4270d4fbf6fce2da1878f1e84a (diff)
downloadlibcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.zip
libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.gz
libcore-a0881d052ee72e3f7e773374e9b1aa75fbd6be4c.tar.bz2
auto import from //branches/cupcake/...@125939
Diffstat (limited to 'dalvik/src/test')
-rw-r--r--dalvik/src/test/java/dalvik/annotation/AndroidOnly.java17
-rw-r--r--dalvik/src/test/java/dalvik/annotation/BrokenTest.java17
-rw-r--r--dalvik/src/test/java/dalvik/annotation/KnownFailure.java17
-rw-r--r--dalvik/src/test/java/dalvik/annotation/TestLevel.java79
-rw-r--r--dalvik/src/test/java/dalvik/annotation/TestTargetClass.java47
-rw-r--r--dalvik/src/test/java/dalvik/annotation/TestTargetNew.java66
-rw-r--r--dalvik/src/test/java/dalvik/annotation/TestTargets.java42
-rw-r--r--dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java58
8 files changed, 343 insertions, 0 deletions
diff --git a/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java b/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java
new file mode 100644
index 0000000..e6a28c8
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/AndroidOnly.java
@@ -0,0 +1,17 @@
+package dalvik.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, ElementType.TYPE })
+public @interface AndroidOnly {
+
+ /**
+ * Plain text reason for adding this annotation.
+ */
+ String value();
+
+}
diff --git a/dalvik/src/test/java/dalvik/annotation/BrokenTest.java b/dalvik/src/test/java/dalvik/annotation/BrokenTest.java
new file mode 100644
index 0000000..a45d374
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/BrokenTest.java
@@ -0,0 +1,17 @@
+package dalvik.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 BrokenTest {
+
+ /**
+ * Plain text reason for adding this annotation.
+ */
+ String value();
+
+}
diff --git a/dalvik/src/test/java/dalvik/annotation/KnownFailure.java b/dalvik/src/test/java/dalvik/annotation/KnownFailure.java
new file mode 100644
index 0000000..6a40ee7
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/KnownFailure.java
@@ -0,0 +1,17 @@
+package dalvik.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 KnownFailure {
+
+ /**
+ * Plain text reason for adding this annotation.
+ */
+ String value();
+
+}
diff --git a/dalvik/src/test/java/dalvik/annotation/TestLevel.java b/dalvik/src/test/java/dalvik/annotation/TestLevel.java
new file mode 100644
index 0000000..a4e41fd
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/TestLevel.java
@@ -0,0 +1,79 @@
+/*
+ * 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 dalvik.annotation;
+
+/**
+ * Defines an enumeration of possible states a test case can be in.
+ *
+ * @since Android 1.0
+ */
+public enum TestLevel {
+
+ /**
+ * Indicates that a test method completely tests its target API method.
+ */
+ COMPLETE,
+
+ /**
+ * Indicates that a test method partially tests its target API method and
+ * that together with all other {@code PARTIAL_COMPLETE} tests for the same
+ * method it is sufficient.
+ */
+ PARTIAL_COMPLETE,
+
+ /**
+ * Indicates that a test method partially tests its target API method. It
+ * needs a second review phase to find out if the sum of all partial tests
+ * is sufficient for completely testing the target API method. If yes, the
+ * level has to be changed to {@code PARTIAL_COMPLETE}.
+ */
+ PARTIAL,
+
+ /**
+ * Indicates that a test method is known to not completely test an API
+ * method but the missing test steps are too complex and costly to
+ * implement. This level is positioned somewhere between {@code PARTIAL}
+ * and {@code COMPLETE}.
+ */
+ SUFFICIENT,
+
+ /**
+ * Indicates that a test method provides additional testing for an API
+ * method for which there already exists one {@code COMPLETE} or a set of
+ * {@code PARTIAL_COMPLETE} tests. This level may also be used for test
+ * methods that test a concept which can not be directly attributed to
+ * the specification of an API method or class.
+ */
+ ADDITIONAL,
+
+ /**
+ * Indicates that there is nothing to test in an API method, for example if
+ * the specification states that a method does nothing.
+ */
+ NOT_NECESSARY,
+
+ /**
+ * Indicates that it is very hard or impossible to test an API method.
+ */
+ NOT_FEASIBLE,
+
+ /**
+ * Indicates that the tests is either insufficient or wrong. Something needs
+ * to be done about it.
+ */
+ TODO,
+
+}
diff --git a/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java b/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java
new file mode 100644
index 0000000..faa4e4b
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/TestTargetClass.java
@@ -0,0 +1,47 @@
+/*
+ * 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 dalvik.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import dalvik.annotation.TestTargetNew;
+
+/**
+ * Defines an annotation for test classes that allows to link them to the class
+ * that is being tested. The current assumption is that the test are somewhat
+ * organized according to the API classes they test. Might be too strict for
+ * some cases.
+ *
+ * @since Android 1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE })
+public @interface TestTargetClass {
+
+ /**
+ * Specifies the class being tested.
+ */
+ Class<?> value();
+
+ /**
+ * Option to specify untested methods for the class.
+ */
+ TestTargetNew[] untestedMethods() default {};
+} \ No newline at end of file
diff --git a/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java b/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java
new file mode 100644
index 0000000..9a85997
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/TestTargetNew.java
@@ -0,0 +1,66 @@
+/*
+ * 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 dalvik.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Defines an annotation used be used within the TestInfo annotation. It
+ * specifies a single method target for the test (but can be used multiple
+ * times).
+ *
+ * @since Android 1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
+public @interface TestTargetNew {
+
+ /**
+ * Specifies the name of the API method that is being tested. This field
+ * may be left empty if the test target is a concept implemented in a
+ * class rather than a concrete API method.
+ */
+ String method() default "";
+
+ /**
+ * Specifies the signature of the API method that is being tested, in terms
+ * of Java classes.
+ */
+ Class<?>[] args() default {};
+
+ /**
+ * Specifies the class to which the tested method belongs. If this value is
+ * not provided, the class identified in @TestTargetClass is used by the
+ * test progress doclet.
+ */
+ Class<?> clazz() default void.class;
+
+ /**
+ * Specifies the level of coverage the tested API method has.
+ */
+ TestLevel level();
+
+ /**
+ * Specifies noteworthy plain-text information about the test, for example
+ * if something is NOT covered by the test method.
+ */
+ String notes() default "";
+}
diff --git a/dalvik/src/test/java/dalvik/annotation/TestTargets.java b/dalvik/src/test/java/dalvik/annotation/TestTargets.java
new file mode 100644
index 0000000..a4e0892
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/TestTargets.java
@@ -0,0 +1,42 @@
+/*
+ * 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 dalvik.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import dalvik.annotation.TestTargetNew;
+
+/**
+ * Defines an annotation for test classes that allows to link them to the class
+ * that is being tested. The current assumption is that the test are somewhat
+ * organized according to the API classes they test. Might be too strict for
+ * some cases.
+ *
+ * @since Android 1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD })
+public @interface TestTargets {
+
+ /**
+ * Specifies the API methods that are tested by the annotated test method.
+ */
+ TestTargetNew[] value();
+} \ No newline at end of file
diff --git a/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java b/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java
new file mode 100644
index 0000000..b6f95ff
--- /dev/null
+++ b/dalvik/src/test/java/dalvik/annotation/VirtualTestTarget.java
@@ -0,0 +1,58 @@
+/*
+ * 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 dalvik.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for "virtual" implementation classes. These are classes that have
+ * the following attributes:
+ * <ul>
+ * <li>they implement a public interface or are a concrete implementation of a
+ * public abstract class,</li>
+ * <li>they are not public,</li>
+ * <li>instances can only be retrieved through some kind of factory method.</li>
+ * </ul>
+ * <p>
+ * Example: {@code MessageDigest} is an abstract class. Concrete implementations
+ * of message digest algorithms such as MD5 and SHA-1 can only be retrieved
+ * through one of the static {@code getInstance} methods of
+ * {@code MessageDigest}, which accept the desired algorithm as a string
+ * parameter and return an implementation accordingly.
+ * </p>
+ * <p>
+ * Even though the concrete implementation class for a message digest algorithm
+ * is not known, we need to be able to indicate that such a class exists and that
+ * it must be tested. This is done by defining corresponding classes and
+ * annotating them with {@code @VirtualTestTarget}. This class can then be
+ * used in the {@code @TestTargetClass} annotation with which we annotate
+ * {@code TestCase} subclasses.
+ *
+ * @since Android 1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE })
+public @interface VirtualTestTarget {
+
+ /**
+ * Field for comments.
+ */
+ String value() default "";
+} \ No newline at end of file