1/* 2 * Copyright (C) 2008 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 17package tests.api.java.net; 18 19import dalvik.annotation.TestTargets; 20import dalvik.annotation.TestLevel; 21import dalvik.annotation.TestTargetNew; 22import dalvik.annotation.TestTargetClass; 23 24import junit.framework.TestCase; 25 26import java.io.IOException; 27import java.io.InputStream; 28import java.io.OutputStream; 29import java.net.CacheRequest; 30import java.net.CacheResponse; 31import java.util.List; 32import java.util.Map; 33 34@TestTargetClass(CacheResponse.class) 35public class CacheResponseTest extends TestCase { 36 37 @TestTargetNew( 38 level = TestLevel.COMPLETE, 39 notes = "", 40 method = "getBody", 41 args = {} 42 ) 43 public void test_getBody() throws IOException { 44 MockCacheResponse mcr = new MockCacheResponse(); 45 assertNull(mcr.getBody()); 46 } 47 48 @TestTargets({ 49 @TestTargetNew( 50 level = TestLevel.COMPLETE, 51 notes = "", 52 method = "getHeaders", 53 args = {} 54 ), 55 @TestTargetNew( 56 level = TestLevel.COMPLETE, 57 notes = "", 58 method = "CacheResponse", 59 args = {} 60 ) 61 }) 62 public void test_getHeaders() throws IOException { 63 MockCacheResponse mcr = new MockCacheResponse(); 64 assertNull(mcr.getHeaders()); 65 } 66 67 class MockCacheResponse extends CacheResponse { 68 69 MockCacheResponse() { 70 super(); 71 } 72 73 @Override 74 public Map<String,List<String>> getHeaders() throws IOException { 75 return null; 76 } 77 78 @Override 79 public InputStream getBody() throws IOException { 80 return null; 81 } 82 } 83} 84