01: /*
02: * Copyright (C) The DNA Group. All rights reserved.
03: *
04: * This software is published under the terms of the DNA
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.dna;
09:
10: import org.codehaus.dna.MissingResourceException;
11:
12: import junit.framework.TestCase;
13:
14: /**
15: *
16: * @author Peter Donald
17: * @version $Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $
18: */
19: public class MissingResourceExceptionTestCase extends TestCase {
20: public void testMissingResourceExceptionConstruction()
21: throws Exception {
22: final String message = "myMessage";
23: final String key = "myKey";
24: final Throwable cause = new Throwable();
25: final MissingResourceException exception = new MissingResourceException(
26: message, key, cause);
27:
28: assertEquals("message", message, exception.getMessage());
29: assertEquals("key", key, exception.getKey());
30: assertEquals("cause", cause, exception.getCause());
31: }
32:
33: public void testMissingResourceExceptionConstructionWithNullCause()
34: throws Exception {
35: final String message = "myMessage";
36: final String key = "myKey";
37: final Throwable cause = null;
38: final MissingResourceException exception = new MissingResourceException(
39: message, key, cause);
40:
41: assertEquals("message", message, exception.getMessage());
42: assertEquals("key", key, exception.getKey());
43: assertEquals("cause", cause, exception.getCause());
44: }
45:
46: public void testMissingResourceExceptionConstructionWithNullKey()
47: throws Exception {
48: final String message = "myMessage";
49: final String key = null;
50: final Throwable cause = new Throwable();
51: final MissingResourceException exception = new MissingResourceException(
52: message, key, cause);
53:
54: assertEquals("message", message, exception.getMessage());
55: assertEquals("key", key, exception.getKey());
56: assertEquals("cause", cause, exception.getCause());
57: }
58:
59: public void testMissingResourceExceptionConstructionWithNullMessage()
60: throws Exception {
61: final String message = null;
62: final String key = "myKey";
63: final Throwable cause = new Throwable();
64: final MissingResourceException exception = new MissingResourceException(
65: message, key, cause);
66:
67: assertEquals("message", message, exception.getMessage());
68: assertEquals("key", key, exception.getKey());
69: assertEquals("cause", cause, exception.getCause());
70: }
71:
72: public void testMissingResourceExceptionConstructionWithSimpleCtor()
73: throws Exception {
74: final String message = "myMessage";
75: final String key = "myKey";
76: final MissingResourceException exception = new MissingResourceException(
77: message, key);
78:
79: assertEquals("message", message, exception.getMessage());
80: assertEquals("key", key, exception.getKey());
81: assertEquals("cause", null, exception.getCause());
82: }
83: }
|