143bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan/* 243bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * Copyright (C) 2016 The Android Open Source Project 343bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * 443bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * Licensed under the Apache License, Version 2.0 (the "License"); 543bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * you may not use this file except in compliance with the License. 643bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * You may obtain a copy of the License at 743bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * 843bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * http://www.apache.org/licenses/LICENSE-2.0 943bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * 1043bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * Unless required by applicable law or agreed to in writing, software 1143bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * distributed under the License is distributed on an "AS IS" BASIS, 1243bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1343bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * See the License for the specific language governing permissions and 1443bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan * limitations under the License. 1543bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan */ 1643bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 1743bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajanpackage com.android.internal.telephony; 1843bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 1943bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajanimport android.test.suitebuilder.annotation.SmallTest; 2043bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 2143bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajanimport org.junit.Test; 2243bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 2343bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajanimport static org.junit.Assert.fail; 2443bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 2543bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajanpublic class PhoneFactoryTest { 2643bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan @Test 2743bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan @SmallTest 2843bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan public void testBeforeMakePhone() { 2943bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan try { 3043bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan Phone phone = PhoneFactory.getDefaultPhone(); 3143bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan fail("Expecting IllegalStateException"); 3243bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } catch (IllegalStateException e) { 3343bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } 3443bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 3543bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan try { 3643bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan Phone phone = PhoneFactory.getPhone(0); 3743bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan fail("Expecting IllegalStateException"); 3843bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } catch (IllegalStateException e) { 3943bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } 4043bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 4143bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan try { 4243bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan Phone[] phone = PhoneFactory.getPhones(); 4343bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan fail("Expecting IllegalStateException"); 4443bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } catch (IllegalStateException e) { 4543bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } 4643bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan } 4743bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan 4843bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan //todo: add test for makeDefaultPhone(). will need some refactoring in PhoneFactory. 4943bc691fbb0fbb39507458c5d64a8088650255c4Amit Mahajan} 50