source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/util/LazyFileOutputStreamTest.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: 1.9 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.util;
18
19import java.io.File;
20import java.io.IOException;
21import junit.framework.TestCase;
22
23/**
24 * @since Ant 1.6
25 */
26public class LazyFileOutputStreamTest extends TestCase {
27 private LazyFileOutputStream los;
28 private final static File f = new File("test.txt");
29
30 public LazyFileOutputStreamTest(String s) {
31 super(s);
32 }
33
34 public void setUp() {
35 los = new LazyFileOutputStream(f);
36 }
37
38 public void tearDown() throws IOException {
39 try {
40 los.close();
41 } finally {
42 f.delete();
43 }
44 }
45
46 public void testNoFileWithoutWrite() throws IOException {
47 los.close();
48 assertTrue(f + " has not been written.", !f.exists());
49 }
50
51 public void testOpen() throws IOException {
52 los.open();
53 los.close();
54 assertTrue(f + " has been written.", f.exists());
55 }
56
57 public void testSingleByte() throws IOException {
58 los.write(0);
59 los.close();
60 assertTrue(f + " has been written.", f.exists());
61 }
62
63 public void testByteArray() throws IOException {
64 los.write(new byte[] {0});
65 los.close();
66 assertTrue(f + " has been written.", f.exists());
67 }
68}
Note: See TracBrowser for help on using the repository browser.