Home | History | Annotate | Download | only in collectors
      1 /*
      2  * Copyright (C) 2017 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 android.device.collectors;
     17 
     18 import org.junit.runner.Description;
     19 import org.junit.runner.Result;
     20 import org.junit.runner.notification.Failure;
     21 
     22 /**
     23  * A Stub class for testing.
     24  */
     25 public class StubTestMetricListener extends BaseMetricListener {
     26 
     27     @Override
     28     public void onTestRunStart(DataRecord runData, Description description) {
     29         runData.addStringMetric("run_start", "run_Start" + description.getClassName());
     30     }
     31 
     32     @Override
     33     public void onTestRunEnd(DataRecord runData, Result result) {
     34         runData.addStringMetric("run_end", "run_end");
     35     }
     36 
     37     @Override
     38     public void onTestStart(DataRecord testData, Description description) {
     39         testData.addStringMetric("test_start", "test_start" + description.getMethodName());
     40     }
     41 
     42     @Override
     43     public void onTestFail(DataRecord testData, Description description, Failure failure) {
     44         testData.addStringMetric("test_fail", "test_fail" + description.getMethodName());
     45     }
     46 
     47     @Override
     48     public void onTestEnd(DataRecord testData, Description description) {
     49         testData.addStringMetric("test_end", "test_end" + description.getMethodName());
     50     }
     51 }