1 /* 2 * Copyright (C) 2012 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 com.android.continuous; 18 19 import com.android.continuous.SmokeTest.TrimListener; 20 import com.android.tradefed.result.ITestInvocationListener; 21 import com.android.tradefed.result.TestDescription; 22 23 import junit.framework.TestCase; 24 25 import org.easymock.EasyMock; 26 27 /** Unit tests for {@link SmokeTest}. */ 28 public class SmokeTestTest extends TestCase { 29 private ITestInvocationListener mListener = null; 30 31 @Override setUp()32 public void setUp() { 33 mListener = EasyMock.createMock(ITestInvocationListener.class); 34 } 35 testRewrite()36 public void testRewrite() { 37 TrimListener trim = new TrimListener(mListener); 38 TestDescription in = 39 new TestDescription( 40 "com.android.smoketest.SmokeTestRunner$3", 41 "com.android.voicedialer.VoiceDialerActivity"); 42 TestDescription out = 43 new TestDescription("SmokeFAST", "com.android.voicedialer.VoiceDialerActivity"); 44 mListener.testStarted(EasyMock.eq(out)); 45 46 EasyMock.replay(mListener); 47 trim.testStarted(in); 48 EasyMock.verify(mListener); 49 } 50 } 51