1 /*
2  * Copyright (C) 2015 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.compatibility.common.util;
17 
18 import java.util.List;
19 
20 /**
21  * Data structure for a Compatibility test case result.
22  */
23 public interface ICaseResult extends Comparable<ICaseResult> {
24 
getName()25     String getName();
26 
27     /**
28      * Gets a {@link ITestResult} for the given test, creating it if it doesn't exist.
29      *
30      * @param testName the name of the test eg &lt;method-name&gt;
31      * @return the {@link ITestResult} or <code>null</code>
32      */
getOrCreateResult(String testName)33     ITestResult getOrCreateResult(String testName);
34 
35     /**
36      * Gets the {@link ITestResult} for given test.
37      *
38      * @param testName the name of the test eg &lt;method-name&gt;
39      * @return the {@link ITestResult} or <code>null</code>
40      */
getResult(String testName)41     ITestResult getResult(String testName);
42 
43     /**
44      * Gets all results sorted by name.
45      */
getResults()46     List<ITestResult> getResults();
47 
48     /**
49      * Gets all results which have the given status.
50      */
getResults(TestStatus status)51     List<ITestResult> getResults(TestStatus status);
52 
53     /**
54      * Counts the number of results which have the given status.
55      */
countResults(TestStatus status)56     int countResults(TestStatus status);
57 
58     /**
59      * Merge the case results from otherCaseResult into this caseResult.
60      */
mergeFrom(ICaseResult otherCaseResult)61     void mergeFrom(ICaseResult otherCaseResult);
62 }
63