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 17 package com.android.compatibility.common.util; 18 19 import com.android.tradefed.util.FileUtil; 20 21 import junit.framework.TestCase; 22 23 import java.io.File; 24 25 /** 26 * Unit tests for {@link LightInvocationResult} 27 */ 28 public class LightInvocationResultTest extends TestCase { 29 30 private File resultsDir; 31 32 @Override setUp()33 public void setUp() throws Exception { 34 resultsDir = FileUtil.createTempDir("results"); 35 } 36 37 @Override tearDown()38 public void tearDown() throws Exception { 39 FileUtil.recursiveDelete(resultsDir); 40 } 41 testLightInvocationResultInstatiate()42 public void testLightInvocationResultInstatiate() throws Exception { 43 File resultDir = ResultHandlerTest.writeResultDir(resultsDir, false); 44 IInvocationResult fullResult = ResultHandler.getResultFromDir(resultDir); 45 LightInvocationResult lightResult = new LightInvocationResult(fullResult); 46 // Ensure that light result implementation does not use a reference to the full result 47 fullResult = null; 48 ResultHandlerTest.checkLightResult(lightResult); 49 } 50 } 51