01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: /**
19: * @author Vera Y. Petrashkova
20: * @version $Revision$
21: */package org.apache.harmony.security.tests.java.security;
22:
23: import java.security.UnrecoverableKeyException;
24:
25: import junit.framework.TestCase;
26:
27: /**
28: * Tests for <code>UnrecoverableKeyException</code> class constructors and
29: * methods.
30: *
31: */
32: public class UnrecoverableKeyExceptionTest extends TestCase {
33:
34: public static void main(String[] args) {
35: }
36:
37: /**
38: * Constructor for UnrecoverableKeyExceptionTests.
39: *
40: * @param arg0
41: */
42: public UnrecoverableKeyExceptionTest(String arg0) {
43: super (arg0);
44: }
45:
46: static String[] msgs = {
47: "",
48: "Check new message",
49: "Check new message Check new message Check new message Check new message Check new message" };
50:
51: static Throwable tCause = new Throwable("Throwable for exception");
52:
53: /**
54: * Test for <code>UnrecoverableKeyException()</code> constructor
55: * Assertion: constructs UnrecoverableKeyException with no detail message
56: */
57: public void testUnrecoverableKeyException01() {
58: UnrecoverableKeyException tE = new UnrecoverableKeyException();
59: assertNull("getMessage() must return null.", tE.getMessage());
60: assertNull("getCause() must return null", tE.getCause());
61: }
62:
63: /**
64: * Test for <code>UnrecoverableKeyException(String)</code> constructor
65: * Assertion: constructs UnrecoverableKeyException with detail message msg.
66: * Parameter <code>msg</code> is not null.
67: */
68: public void testUnrecoverableKeyException02() {
69: UnrecoverableKeyException tE;
70: for (int i = 0; i < msgs.length; i++) {
71: tE = new UnrecoverableKeyException(msgs[i]);
72: assertEquals("getMessage() must return: ".concat(msgs[i]),
73: tE.getMessage(), msgs[i]);
74: assertNull("getCause() must return null", tE.getCause());
75: }
76: }
77:
78: /**
79: * Test for <code>UnrecoverableKeyException(String)</code> constructor
80: * Assertion: constructs UnrecoverableKeyException when <code>msg</code>
81: * is null
82: */
83: public void testUnrecoverableKeyException03() {
84: String msg = null;
85: UnrecoverableKeyException tE = new UnrecoverableKeyException(
86: msg);
87: assertNull("getMessage() must return null.", tE.getMessage());
88: assertNull("getCause() must return null", tE.getCause());
89: }
90:
91: }
|