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 */ 16package com.android.internal.telephony; 17 18import static org.junit.Assert.assertEquals; 19 20import android.test.suitebuilder.annotation.SmallTest; 21 22import org.junit.After; 23import org.junit.Test; 24 25public class CallStateExceptionTest { 26 private CallStateException mCallStateException; 27 28 @After 29 public void tearDown() throws Exception { 30 mCallStateException = null; 31 } 32 33 @Test 34 @SmallTest 35 public void testCallStateExceptionDefault() { 36 mCallStateException = new CallStateException("sanity test"); 37 assertEquals("sanity test", mCallStateException.getMessage()); 38 assertEquals(mCallStateException.ERROR_INVALID, mCallStateException.getError()); 39 } 40 41 @Test 42 @SmallTest 43 public void testCallStateExceptionWithErrCode() { 44 mCallStateException = new CallStateException(mCallStateException.ERROR_OUT_OF_SERVICE, 45 "sanity test with err code"); 46 assertEquals("sanity test with err code", mCallStateException.getMessage()); 47 assertEquals(mCallStateException.ERROR_OUT_OF_SERVICE, mCallStateException.getError()); 48 } 49} 50