1 /*
2  * Copyright (C) 2016 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 package com.android.tradefed.testtype;
17 
18 import java.util.Set;
19 
20 /**
21  * A runner that can filter which tests to run based on annotations.
22  *
23  * <p>A test will be run IFF it matches one or more of the include filters AND does not match any
24  * of the exclude filters. If no include filters are given all tests should be run as long as they
25  * do not match any of the exclude filters.</p>
26  */
27 public interface ITestAnnotationFilterReceiver {
28     /**
29      * Adds an annotation to include if a tests if marked with it.
30      */
addIncludeAnnotation(String annotation)31     void addIncludeAnnotation(String annotation);
32 
33     /**
34      * Adds an annotation to exclude if a tests if marked with it.
35      */
addExcludeAnnotation(String notAnnotation)36     void addExcludeAnnotation(String notAnnotation);
37 
38     /**
39      * Adds a {@link Set} of annotations to include if a tests if marked with it.
40      */
addAllIncludeAnnotation(Set<String> annotations)41     void addAllIncludeAnnotation(Set<String> annotations);
42 
43     /**
44      * Adds a {@link Set} of annotations to exclude if a tests if marked with it.
45      */
addAllExcludeAnnotation(Set<String> notAnnotations)46     void addAllExcludeAnnotation(Set<String> notAnnotations);
47 
48     /** Returns the current {@link Set} of annotations to include. */
getIncludeAnnotations()49     Set<String> getIncludeAnnotations();
50 
51     /** Returns the current {@link Set} of annotations to exclude. */
getExcludeAnnotations()52     Set<String> getExcludeAnnotations();
53 
54     /** Delete all the include annotations currently tracked. */
clearIncludeAnnotations()55     void clearIncludeAnnotations();
56 
57     /** Delete all the exclude annotations currently tracked. */
clearExcludeAnnotations()58     void clearExcludeAnnotations();
59 }
60