1 | /*
|
---|
2 | * Copyright 2002,2004 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 | package org.apache.tools.ant.taskdefs.condition;
|
---|
18 |
|
---|
19 | import org.apache.tools.ant.Project;
|
---|
20 | import org.apache.tools.ant.BuildException;
|
---|
21 | import org.apache.tools.ant.BuildFileTest;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Testcases for the <isreference> condition.
|
---|
25 | *
|
---|
26 | */
|
---|
27 | public class IsReferenceTest extends BuildFileTest {
|
---|
28 |
|
---|
29 | public IsReferenceTest(String name) {
|
---|
30 | super(name);
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * The JUnit setup method
|
---|
35 | */
|
---|
36 | public void setUp() {
|
---|
37 | configureProject("src/etc/testcases/taskdefs/conditions/isreference.xml");
|
---|
38 | }
|
---|
39 |
|
---|
40 | public void testBasic() {
|
---|
41 | expectPropertySet("basic", "global-path");
|
---|
42 | assertPropertySet("target-path");
|
---|
43 | assertPropertyUnset("undefined");
|
---|
44 | }
|
---|
45 |
|
---|
46 | public void testNotEnoughArgs() {
|
---|
47 | expectSpecificBuildException("isreference-incomplete",
|
---|
48 | "refid attribute has been omitted",
|
---|
49 | "No reference specified for isreference "
|
---|
50 | + "condition");
|
---|
51 | }
|
---|
52 |
|
---|
53 | public void testType() {
|
---|
54 | expectPropertySet("type", "global-path");
|
---|
55 | assertPropertyUnset("global-path-as-fileset");
|
---|
56 | assertPropertyUnset("global-path-as-foo");
|
---|
57 | assertPropertySet("global-echo");
|
---|
58 | }
|
---|
59 |
|
---|
60 | }
|
---|