1 /*
2  * Copyright (C) 2019 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.internal.net.eap.test;
18 
19 import static android.telephony.TelephonyManager.APPTYPE_USIM;
20 
21 import android.net.eap.test.EapSessionConfig;
22 
23 import java.util.HashMap;
24 
25 /**
26  * EapTestUtils is a util class for providing test-values of EAP-related objects.
27  */
28 public class EapTestUtils {
29     /**
30      * Creates and returns a dummy EapSessionConfig instance.
31      *
32      * @return a new, empty EapSessionConfig instance
33      */
getDummyEapSessionConfig()34     public static EapSessionConfig getDummyEapSessionConfig() {
35         return new EapSessionConfig(new HashMap<>(), new byte[0]);
36     }
37 
38     /**
39      * Creates and returns a dummy EapSessionConfig instance with the given EAP-Identity.
40      *
41      * @param eapIdentity byte-array representing the EAP-Identity of the client
42      * @return a new, empty EapSessionConfig instance with the given EAP-Identity
43      */
getDummyEapSessionConfig(byte[] eapIdentity)44     public static EapSessionConfig getDummyEapSessionConfig(byte[] eapIdentity) {
45         return new EapSessionConfig(new HashMap<>(), eapIdentity);
46     }
47 
48     /**
49      * Creates and returns a dummy EapSessionConfig instance with EAP-SIM configured.
50      *
51      * @return a new EapSessionConfig with EAP-SIM configs set
52      */
getDummyEapSimSessionConfig()53     public static EapSessionConfig getDummyEapSimSessionConfig() {
54         return new EapSessionConfig.Builder().setEapSimConfig(0, APPTYPE_USIM).build();
55     }
56 }
57