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: */
18: package org.apache.tools.ant.taskdefs;
19:
20: import org.apache.tools.ant.BuildFileTest;
21: import org.apache.tools.ant.util.FileUtils;
22:
23: /**
24: */
25: public class GUnzipTest extends BuildFileTest {
26:
27: /** Utilities used for file operations */
28: private static final FileUtils FILE_UTILS = FileUtils
29: .getFileUtils();
30:
31: public GUnzipTest(String name) {
32: super (name);
33: }
34:
35: public void setUp() {
36: configureProject("src/etc/testcases/taskdefs/gunzip.xml");
37: }
38:
39: public void tearDown() {
40: executeTarget("cleanup");
41: }
42:
43: public void test1() {
44: expectBuildException("test1", "required argument missing");
45: }
46:
47: public void test2() {
48: expectBuildException("test2", "attribute src invalid");
49: }
50:
51: public void testRealTest() throws java.io.IOException {
52: testRealTest("realTest");
53: }
54:
55: public void testRealTestWithResource() throws java.io.IOException {
56: testRealTest("realTestWithResource");
57: }
58:
59: private void testRealTest(String target) throws java.io.IOException {
60: executeTarget(target);
61: assertTrue(FILE_UTILS.contentEquals(project
62: .resolveFile("../asf-logo.gif"), project
63: .resolveFile("asf-logo.gif")));
64: }
65:
66: public void testTestGzipTask() throws java.io.IOException {
67: testRealTest("testGzipTask");
68: }
69:
70: public void testDocumentationClaimsOnCopy()
71: throws java.io.IOException {
72: testRealTest("testDocumentationClaimsOnCopy");
73: }
74: }
|