1/* 2 * Copyright (C) 2011 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 com.android.volley.mock; 18 19import com.android.volley.Cache; 20 21public class MockCache implements Cache { 22 23 public boolean clearCalled = false; 24 @Override 25 public void clear() { 26 clearCalled = true; 27 } 28 29 public boolean getCalled = false; 30 private Entry mFakeEntry = null; 31 32 public void setEntryToReturn(Entry entry) { 33 mFakeEntry = entry; 34 } 35 36 @Override 37 public Entry get(String key) { 38 getCalled = true; 39 return mFakeEntry; 40 } 41 42 public boolean putCalled = false; 43 public String keyPut = null; 44 public Entry entryPut = null; 45 46 @Override 47 public void put(String key, Entry entry) { 48 putCalled = true; 49 keyPut = key; 50 entryPut = entry; 51 } 52 53 @Override 54 public void invalidate(String key, boolean fullExpire) { 55 } 56 57 @Override 58 public void remove(String key) { 59 } 60 61 @Override 62 public void initialize() { 63 } 64 65} 66