1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php 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 com.android.annotations; 18 19 import java.lang.annotation.Retention; 20 import java.lang.annotation.RetentionPolicy; 21 22 /** 23 * Denotes that the class, method or field has its visibility relaxed so 24 * that unit tests can access it. 25 * <p/> 26 * The <code>visibility</code> argument can be used to specific what the original 27 * visibility should have been if it had not been made public or package-private for testing. 28 * The default is to consider the element private. 29 */ 30 @Retention(RetentionPolicy.SOURCE) 31 public @interface VisibleForTesting { 32 /** 33 * Intended visibility if the element had not been made public or package-private for 34 * testing. 35 */ 36 enum Visibility { 37 /** The element should be considered protected. */ 38 PROTECTED, 39 /** The element should be considered package-private. */ 40 PACKAGE, 41 /** The element should be considered private. */ 42 PRIVATE 43 } 44 45 /** 46 * Intended visibility if the element had not been made public or package-private for testing. 47 * If not specified, one should assume the element originally intended to be private. 48 */ 49 Visibility visibility() default Visibility.PRIVATE; 50 } 51