Home | History | Annotate | Download | only in ssl
      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 javax.net.ssl.SSLKeyException;
     19 
     20 import junit.framework.TestCase;
     21 
     22 public class SSLKeyExceptionTest 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>SSLKeyException(String)</code> constructor Assertion:
     32      * constructs SSLKeyException with detail message msg. Parameter
     33      * <code>msg</code> is not null.
     34      */
     35     public void test_Constructor01() {
     36         SSLKeyException skE;
     37         for (int i = 0; i < msgs.length; i++) {
     38             skE = new SSLKeyException(msgs[i]);
     39             assertEquals("getMessage() must return: ".concat(msgs[i]), skE.getMessage(), msgs[i]);
     40             assertNull("getCause() must return null", skE.getCause());
     41         }
     42     }
     43 
     44     /**
     45      * Test for <code>SSLPeerUnverifiedException(String)</code> constructor Assertion:
     46      * constructs SSLPeerUnverifiedException with detail message msg. Parameter
     47      * <code>msg</code> is null.
     48      */
     49     public void test_Constructor02() {
     50         String msg = null;
     51         SSLKeyException skE = new SSLKeyException(msg);
     52         assertNull("getMessage() must return null.", skE.getMessage());
     53         assertNull("getCause() must return null", skE.getCause());
     54     }
     55 }
     56