source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/types/AssertionsTest.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.6 KB
Line 
1/*
2 * Copyright 2003-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 */
17package org.apache.tools.ant.types;
18
19import org.apache.tools.ant.BuildFileTest;
20
21/**
22 * test assertion handling
23 */
24public class AssertionsTest extends BuildFileTest {
25
26 public AssertionsTest(String name) {
27 super(name);
28 }
29
30 protected void setUp() throws Exception {
31 configureProject("src/etc/testcases/types/assertions.xml");
32 }
33
34 protected void tearDown() throws Exception {
35 executeTarget("teardown");
36 }
37
38 /**
39 * runs a test and expects an assertion thrown in forked code
40 * @param target
41 */
42 protected void expectAssertion(String target) {
43 expectBuildExceptionContaining(target,
44 "assertion not thrown in "+target,
45 "Java returned: 1");
46 }
47
48 public void testClassname() {
49 expectAssertion("test-classname");
50 }
51
52 public void testPackage() {
53 expectAssertion("test-package");
54 }
55
56 public void testEmptyAssertions() {
57 executeTarget("test-empty-assertions");
58 }
59
60 public void testDisable() {
61 executeTarget("test-disable");
62 }
63
64 public void testOverride() {
65 expectAssertion("test-override");
66 }
67
68 public void testOverride2() {
69 executeTarget("test-override2");
70 }
71 public void testReferences() {
72 expectAssertion("test-references");
73 }
74
75 public void testMultipleAssertions() {
76 expectBuildExceptionContaining("test-multiple-assertions",
77 "multiple assertions rejected",
78 "Only one assertion declaration is allowed");
79 }
80
81 public void testReferenceAbuse() {
82 expectBuildExceptionContaining("test-reference-abuse",
83 "reference abuse rejected",
84 "You must not specify more than one attribute when using refid");
85 }
86
87 public void testNofork() {
88 expectLogContaining("test-nofork",
89 "Assertion statements are currently ignored in non-forked mode");
90 }
91
92
93}
94
95
Note: See TracBrowser for help on using the repository browser.