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: package org.apache.harmony.print.tests.javax.print;
19:
20: import javax.print.PrintException;
21: import junit.framework.TestCase;
22:
23: public class PrintExceptionTest extends TestCase {
24: /**
25: * Test method for {@link javax.print.PrintException#PrintException()}.
26: */
27: public void testPrintException() {
28: PrintException pe = new PrintException();
29: assertNull(pe.getMessage());
30: assertNull(pe.getCause());
31: }
32:
33: /**
34: * Test method for {@link javax.print.PrintException#PrintException(java.lang.String)}.
35: */
36: public void testPrintExceptionString() {
37: PrintException pe = new PrintException("message");
38: assertEquals("message", pe.getMessage());
39: assertNull(pe.getCause());
40: }
41:
42: /**
43: * Test method for {@link javax.print.PrintException#PrintException(java.lang.Exception)}.
44: */
45: public void testPrintExceptionException() {
46: NullPointerException npe = new NullPointerException("npe");
47: PrintException pe = new PrintException(npe);
48: assertNotNull(pe.getMessage());
49: assertSame(npe, pe.getCause());
50:
51: pe = new PrintException((Exception) null);
52: assertNull(pe.getMessage());
53: assertNull(pe.getCause());
54: }
55:
56: /**
57: * Test method for {@link javax.print.PrintException#PrintException(java.lang.String, java.lang.Exception)}.
58: */
59: public void testPrintExceptionStringException() {
60: NullPointerException npe = new NullPointerException("npe");
61: PrintException pe = new PrintException("message", npe);
62: assertEquals("message", pe.getMessage());
63: assertSame(npe, pe.getCause());
64: }
65: }
|