The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package testprogress2; |
| 18 | |
| 19 | import com.sun.javadoc.ExecutableMemberDoc; |
| 20 | |
| 21 | import java.util.ArrayList; |
| 22 | import java.util.List; |
| 23 | |
| 24 | // points from one targetMethod to 0..n testMethods which test the target method |
| 25 | public class AnnotationPointer { |
| 26 | final ExecutableMemberDoc targetMethod; |
| 27 | |
| 28 | private List<TestTargetNew> targets = new ArrayList<TestTargetNew>(); |
| 29 | |
| 30 | AnnotationPointer(ExecutableMemberDoc targetMethod) { |
| 31 | this.targetMethod = targetMethod; |
| 32 | } |
| 33 | |
| 34 | public void addTestTargetNew(TestTargetNew testMethodInfo) { |
| 35 | /* |
| 36 | * if (testMethods.contains(testMethodInfo)) { throw new |
| 37 | * RuntimeException("warn: testMethod refers more than once to the |
| 38 | * targetMethod, testMethod="+testMethodInfo.getMethodDoc()); |
| 39 | * //System.out.println("warn: testMethod refers more than once to the |
| 40 | * targetMethod, testMethod="+testMethod); } else { |
| 41 | */ |
| 42 | targets.add(testMethodInfo); |
| 43 | // } |
| 44 | } |
| 45 | |
| 46 | public List<TestTargetNew> getTargets() { |
| 47 | return targets; |
| 48 | } |
| 49 | |
| 50 | public void addProxiesFrom(AnnotationPointer ap) { |
| 51 | List<TestTargetNew> t = ap.targets; |
| 52 | // clone the TestTargetNew and add to it a note from which |
| 53 | // target method it orignally stems |
| 54 | for (TestTargetNew ttn : t) { |
| 55 | TestTargetNew tnew = ttn.cloneMe("<b>(INDIRECTLY tested)</b>"); |
| 56 | targets.add(tnew); |
| 57 | } |
| 58 | } |
| 59 | } |