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.pluto.util;
18:
19: /**
20: * Test Class
21: *
22: * @version 1.0
23: * @since June 1, 2005
24: */
25: public class ArgumentUtilityTest extends PlutoTestCase {
26:
27: public void testValidateNotNullWhenNull() throws Exception {
28: Object[] parameters = new Object[] { "arg", null };
29: assertException(new ArgumentUtility(), "validateNotNull",
30: parameters, IllegalArgumentException.class);
31: }
32:
33: public void testValidateNotNullWhenNotNull() {
34: ArgumentUtility.validateNotNull("arg", "notnull");
35: }
36:
37: public void testValidateNotNullOrEmptyWhenNull() {
38:
39: Object[] parameters = new Object[] { "arg", null };
40: Class[] parameterTypes = new Class[] { String.class,
41: String.class };
42: assertException(new ArgumentUtility(), "validateNotEmpty",
43: parameterTypes, parameters,
44: IllegalArgumentException.class);
45: }
46:
47: public void testValidateNotNullOrEmptyWhenEmpty() {
48:
49: Object[] parameters = new Object[] { "arg", "" };
50: assertException(new ArgumentUtility(), "validateNotEmpty",
51: parameters, IllegalArgumentException.class);
52: }
53:
54: public void testValidateNotNullOrEmptyWhenValid() {
55: ArgumentUtility.validateNotEmpty("arg", "notempty");
56: }
57:
58: }
|