SSLProtocolExceptionTest.java revision c46a2ea848e7a62cd5ee24216e446ad7b9ba7629
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 */ 16package org.apache.harmony.tests.javax.net.ssl; 17 18import javax.net.ssl.SSLProtocolException; 19 20import junit.framework.TestCase; 21 22public class SSLProtocolExceptionTest extends TestCase { 23 24 private static String[] msgs = { 25 "", 26 "Check new message", 27 "Check new message Check new message Check new message Check new message Check new message" }; 28 29 30 /** 31 * Test for <code>SSLProtocolException(String)</code> constructor Assertion: 32 * constructs SSLProtocolException with detail message msg. Parameter 33 * <code>msg</code> is not null. 34 */ 35 public void test_Constructor01() { 36 SSLProtocolException sslE; 37 for (int i = 0; i < msgs.length; i++) { 38 sslE = new SSLProtocolException(msgs[i]); 39 assertEquals("getMessage() must return: ".concat(msgs[i]), sslE.getMessage(), msgs[i]); 40 assertNull("getCause() must return null", sslE.getCause()); 41 } 42 } 43 44 /** 45 * Test for <code>SSLProtocolException(String)</code> constructor Assertion: 46 * constructs SSLProtocolException with detail message msg. Parameter 47 * <code>msg</code> is null. 48 */ 49 public void test_Constructor02() { 50 String msg = null; 51 SSLProtocolException sslE = new SSLProtocolException(msg); 52 assertNull("getMessage() must return null.", sslE.getMessage()); 53 assertNull("getCause() must return null", sslE.getCause()); 54 } 55} 56