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: package org.apache.commons.lang;
18:
19: import junit.framework.Test;
20: import junit.framework.TestCase;
21: import junit.framework.TestSuite;
22: import junit.textui.TestRunner;
23:
24: /**
25: * JUnit tests.
26: *
27: * @author Matthew Hawthorne
28: * @version $Id: IncompleteArgumentExceptionTest.java 437554 2006-08-28 06:21:41Z bayard $
29: * @see IncompleteArgumentException
30: */
31: public class IncompleteArgumentExceptionTest extends TestCase {
32:
33: public static void main(String[] args) {
34: TestRunner.run(suite());
35: }
36:
37: public static Test suite() {
38: return new TestSuite(IncompleteArgumentExceptionTest.class);
39: }
40:
41: public IncompleteArgumentExceptionTest(String testName) {
42: super (testName);
43: }
44:
45: // testConstructor
46:
47: public void test1arg_nullInput() {
48: final Throwable t = new IncompleteArgumentException(null);
49: assertEquals("null is incomplete.", t.getMessage());
50: }
51:
52: public void test1arg_validInput() {
53: final String name = "argument";
54: final Throwable t = new IncompleteArgumentException(name);
55: assertEquals(name + " is incomplete.", t.getMessage());
56: }
57:
58: public void test2arg_allNullInput() {
59: final Throwable t = new IncompleteArgumentException(null, null);
60: assertEquals("null is missing the following items: null", t
61: .getMessage());
62: }
63:
64: public void test2arg_nullString() {
65: final Throwable t = new IncompleteArgumentException(null,
66: new String[] { "one", "two" });
67: assertEquals("null is missing the following items: [one, two]",
68: t.getMessage());
69: }
70:
71: public void test2arg_nullArray() {
72: final String name = "one";
73: final Throwable t = new IncompleteArgumentException(name, null);
74: assertEquals(name + " is missing the following items: null", t
75: .getMessage());
76: }
77:
78: public void test2arg_validInput() {
79: final String name = "input";
80: final Throwable t = new IncompleteArgumentException(name,
81: new String[] { "one", "two" });
82: assertEquals(name
83: + " is missing the following items: [one, two]", t
84: .getMessage());
85: }
86:
87: } // IncompleteArgumentExceptionTest
|