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 android.telephony.ims;
18 
19 import static org.mockito.Mockito.spy;
20 
21 import android.content.Context;
22 import android.telephony.ims.feature.MmTelFeature;
23 import android.telephony.ims.feature.RcsFeature;
24 import android.telephony.ims.stub.ImsFeatureConfiguration;
25 
26 import org.mockito.MockitoAnnotations;
27 
28 /**
29  * Test ImsService used by mockito to verify functionality.
30  */
31 
32 public class TestImsService extends android.telephony.ims.ImsService {
33 
34     public TestMmTelFeature mSpyMmTelFeature;
35     public TestMmTelFeature mTestMmTelFeature;
36 
37     public ImsFeatureConfiguration testFeatureConfig;
38 
TestImsService(Context context)39     public TestImsService(Context context) {
40         attachBaseContext(context);
41         MockitoAnnotations.initMocks(this);
42         // Must create real MMTelFeature to initialize ImsFeature objects.
43         mTestMmTelFeature = new TestMmTelFeature();
44         mSpyMmTelFeature = spy(mTestMmTelFeature);
45     }
46 
47     @Override
createMmTelFeature(int slotId)48     public MmTelFeature createMmTelFeature(int slotId) {
49         return mSpyMmTelFeature;
50     }
51 
52     @Override
createRcsFeature(int slotId)53     public RcsFeature createRcsFeature(int slotId) {
54         return null;
55     }
56 
57     @Override
querySupportedImsFeatures()58     public ImsFeatureConfiguration querySupportedImsFeatures() {
59         return testFeatureConfig;
60     }
61 }
62