PortUnreachableExceptionTest.java revision cc05ad238516f1303687aba4a978e24e57c0c07a
1/* 2 * Copyright (C) 2008 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 tests.api.java.net; 18 19import junit.framework.TestCase; 20 21import dalvik.annotation.TestTargets; 22import dalvik.annotation.TestLevel; 23import dalvik.annotation.TestTargetNew; 24import dalvik.annotation.TestTargetClass; 25 26import java.net.PasswordAuthentication; 27import java.net.PortUnreachableException; 28 29@TestTargetClass(PortUnreachableException.class) 30public class PortUnreachableExceptionTest extends TestCase { 31 32 @TestTargetNew( 33 level = TestLevel.COMPLETE, 34 notes = "", 35 method = "PortUnreachableException", 36 args = {} 37 ) 38 public void test_Constructor() { 39 PortUnreachableException pue = new PortUnreachableException(); 40 assertNull(pue.getMessage()); 41 } 42 43 @TestTargetNew( 44 level = TestLevel.COMPLETE, 45 notes = "", 46 method = "PortUnreachableException", 47 args = {java.lang.String.class} 48 ) 49 public void test_ConstructorLString() { 50 String [] messages = {"", null, "Test Message"}; 51 for(String str:messages) { 52 PortUnreachableException pue = new PortUnreachableException(str); 53 assertEquals(str, pue.getMessage()); 54 } 55 } 56} 57