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.internal.telephony; 18 19import android.test.suitebuilder.annotation.SmallTest; 20 21import org.junit.Test; 22 23import static org.junit.Assert.fail; 24 25public class PhoneFactoryTest { 26 @Test 27 @SmallTest 28 public void testBeforeMakePhone() { 29 try { 30 Phone phone = PhoneFactory.getDefaultPhone(); 31 fail("Expecting IllegalStateException"); 32 } catch (IllegalStateException e) { 33 } 34 35 try { 36 Phone phone = PhoneFactory.getPhone(0); 37 fail("Expecting IllegalStateException"); 38 } catch (IllegalStateException e) { 39 } 40 41 try { 42 Phone[] phone = PhoneFactory.getPhones(); 43 fail("Expecting IllegalStateException"); 44 } catch (IllegalStateException e) { 45 } 46 } 47 48 //todo: add test for makeDefaultPhone(). will need some refactoring in PhoneFactory. 49} 50