1 /* 2 * Copyright (C) 2007 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 package tests.api.javax.net.ssl; 17 18 import dalvik.annotation.TestTargetClass; 19 import dalvik.annotation.TestTargets; 20 import dalvik.annotation.TestLevel; 21 import dalvik.annotation.TestTargetNew; 22 23 import javax.net.ssl.SSLPeerUnverifiedException; 24 25 import junit.framework.TestCase; 26 27 @TestTargetClass(SSLPeerUnverifiedException.class) 28 public class SSLPeerUnverifiedExceptionTest extends TestCase { 29 30 private static String[] msgs = { 31 "", 32 "Check new message", 33 "Check new message Check new message Check new message Check new message Check new message" }; 34 35 36 /** 37 * Test for <code>SSLPeerUnverifiedException(String)</code> constructor Assertion: 38 * constructs SSLPeerUnverifiedException with detail message msg. Parameter 39 * <code>msg</code> is not null. 40 */ 41 @TestTargetNew( 42 level = TestLevel.PARTIAL_COMPLETE, 43 notes = "", 44 method = "SSLPeerUnverifiedException", 45 args = {java.lang.String.class} 46 ) 47 public void test_Constructor01() { 48 SSLPeerUnverifiedException sslE; 49 for (int i = 0; i < msgs.length; i++) { 50 sslE = new SSLPeerUnverifiedException(msgs[i]); 51 assertEquals("getMessage() must return: ".concat(msgs[i]), sslE.getMessage(), msgs[i]); 52 assertNull("getCause() must return null", sslE.getCause()); 53 } 54 } 55 56 /** 57 * Test for <code>SSLPeerUnverifiedException(String)</code> constructor Assertion: 58 * constructs SSLPeerUnverifiedException with detail message msg. Parameter 59 * <code>msg</code> is null. 60 */ 61 @TestTargetNew( 62 level = TestLevel.PARTIAL_COMPLETE, 63 notes = "", 64 method = "SSLPeerUnverifiedException", 65 args = {java.lang.String.class} 66 ) 67 public void test_Constructor02() { 68 String msg = null; 69 SSLPeerUnverifiedException sslE = new SSLPeerUnverifiedException(msg); 70 assertNull("getMessage() must return null.", sslE.getMessage()); 71 assertNull("getCause() must return null", sslE.getCause()); 72 } 73 } 74