Home | History | Annotate | Download | only in auth
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 
     18 package tests.api.javax.security.auth;
     19 
     20 import dalvik.annotation.TestLevel;
     21 import dalvik.annotation.TestTargetClass;
     22 import dalvik.annotation.TestTargetNew;
     23 
     24 import junit.framework.TestCase;
     25 
     26 import javax.security.auth.DestroyFailedException;
     27 
     28 /**
     29  * Tests for <code>DestroyFailedException</code> class constructors and methods.
     30  *
     31  */
     32 @TestTargetClass(DestroyFailedException.class)
     33 public class DestroyFailedExceptionTest extends TestCase {
     34 
     35     public static void main(String[] args) {
     36     }
     37 
     38     /**
     39      * Constructor for DestroyFailedExceptionTest.
     40      *
     41      * @param arg0
     42      */
     43     public DestroyFailedExceptionTest(String arg0) {
     44         super(arg0);
     45     }
     46 
     47     private static String[] msgs = {
     48             "",
     49             "Check new message",
     50             "Check new message Check new message Check new message Check new message Check new message" };
     51 
     52 
     53     /**
     54      * @tests javax.security.auth.DestroyFailedException#DestroyFailedException()
     55      * Assertion: constructs DestroyFailedException with no detail message
     56      */
     57     @TestTargetNew(
     58         level = TestLevel.COMPLETE,
     59         notes = "",
     60         method = "DestroyFailedException",
     61         args = {}
     62     )
     63     public void testDestroyFailedException01() {
     64         DestroyFailedException dfE = new DestroyFailedException();
     65         assertNull("getMessage() must return null.", dfE.getMessage());
     66         assertNull("getCause() must return null", dfE.getCause());
     67     }
     68 
     69     /**
     70      * @tests javax.security.auth.DestroyFailedException#DestroyFailedException(String msg)
     71      * Assertion: constructs with not null parameter.
     72      */
     73     @TestTargetNew(
     74         level = TestLevel.PARTIAL_COMPLETE,
     75         notes = "",
     76         method = "DestroyFailedException",
     77         args = {String.class}
     78     )
     79     public void testDestroyFailedException02() {
     80         DestroyFailedException dfE;
     81         for (int i = 0; i < msgs.length; i++) {
     82             dfE = new DestroyFailedException(msgs[i]);
     83             assertEquals("getMessage() must return: ".concat(msgs[i]), dfE.getMessage(), msgs[i]);
     84             assertNull("getCause() must return null", dfE.getCause());
     85         }
     86     }
     87 
     88     /**
     89      * @tests javax.security.auth.DestroyFailedException#DestroyFailedException(String msg)
     90      * Assertion: constructs with null parameter.
     91      */
     92     @TestTargetNew(
     93         level = TestLevel.PARTIAL_COMPLETE,
     94         notes = "",
     95         method = "DestroyFailedException",
     96         args = {String.class}
     97     )
     98     public void testDestroyFailedException03() {
     99         String msg = null;
    100         DestroyFailedException dfE = new DestroyFailedException(msg);
    101         assertNull("getMessage() must return null.", dfE.getMessage());
    102         assertNull("getCause() must return null", dfE.getCause());
    103     }
    104 }
    105