KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > TypedefTest


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 package org.apache.tools.ant.taskdefs;
19
20 import org.apache.tools.ant.Project;
21 import org.apache.tools.ant.BuildFileTest;
22
23 /**
24  */

25 public class TypedefTest extends BuildFileTest {
26
27     public TypedefTest(String JavaDoc name) {
28         super(name);
29     }
30
31     public void setUp() {
32         configureProject("src/etc/testcases/taskdefs/typedef.xml");
33     }
34
35     public void testEmpty() {
36         expectBuildException("empty", "required argument not specified");
37     }
38
39     public void testNoName() {
40         expectBuildException("noName", "required argument not specified");
41     }
42
43     public void testNoClassname() {
44         expectBuildException("noClassname", "required argument not specified");
45     }
46
47     public void testClassNotFound() {
48         expectBuildException("classNotFound",
49                              "classname specified doesn't exist");
50     }
51
52     public void testGlobal() {
53         expectLog("testGlobal", "");
54         Object JavaDoc ref = project.getReferences().get("global");
55         assertNotNull("ref is not null", ref);
56         assertEquals("org.example.types.TypedefTestType",
57                      ref.getClass().getName());
58     }
59
60     public void testLocal() {
61         expectLog("testLocal", "");
62         Object JavaDoc ref = project.getReferences().get("local");
63         assertNotNull("ref is not null", ref);
64         assertEquals("org.example.types.TypedefTestType",
65                      ref.getClass().getName());
66     }
67
68     /**
69      * test to make sure that one can define a not present
70      * optional type twice and then have a valid definition.
71      */

72     public void testDoubleNotPresent() {
73         expectLogContaining("double-notpresent", "hi");
74     }
75 }
76
Popular Tags