1/*
2 * Copyright (C) 2016 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.server.wifi;
18
19import java.util.HashMap;
20
21public class MockResources extends android.test.mock.MockResources {
22
23    private HashMap<Integer, Boolean> mBooleanValues;
24    private HashMap<Integer, Integer> mIntegerValues;
25    private HashMap<Integer, String>  mStringValues;
26
27    public MockResources() {
28        mBooleanValues = new HashMap<Integer, Boolean>();
29        mIntegerValues = new HashMap<Integer, Integer>();
30        mStringValues  = new HashMap<Integer, String>();
31    }
32
33    @Override
34    public boolean getBoolean(int id) {
35        if (mBooleanValues.containsKey(id)) {
36            return mBooleanValues.get(id);
37        } else {
38            return false;
39        }
40    }
41
42    @Override
43    public int getInteger(int id) {
44        if (mIntegerValues.containsKey(id)) {
45            return mIntegerValues.get(id);
46        } else {
47            return 0;
48        }
49    }
50
51    @Override
52    public String getString(int id) {
53        if (mStringValues.containsKey(id)) {
54            return mStringValues.get(id);
55        } else {
56            return null;
57        }
58    }
59
60    public void setBoolean(int id, boolean value) {
61        mBooleanValues.put(id, value);
62    }
63
64    public void setInteger(int id, int value) {
65        mIntegerValues.put(id, value);
66    }
67
68    public void setString(int id, String value) {
69        mStringValues.put(id, value);
70    }
71}
72