001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 * 
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.io;
018
019import java.io.File;
020
021import org.apache.commons.io.testtools.FileBasedTestCase;
022
023/**
024 * This is used to test FileUtils.waitFor() method for correctness.
025 *
026 * @version $Id: FileUtilsWaitForTestCase.java 1415850 2012-11-30 20:51:39Z ggregory $
027 * @see FileUtils
028 */
029public class FileUtilsWaitForTestCase extends FileBasedTestCase {
030    // This class has been broken out from FileUtilsTestCase
031    // to solve issues as per BZ 38927
032
033    public FileUtilsWaitForTestCase(final String name) {
034        super(name);
035    }
036
037    /** @see junit.framework.TestCase#setUp() */
038    @Override
039    protected void setUp() throws Exception {
040        getTestDirectory().mkdirs();
041    }
042
043    /** @see junit.framework.TestCase#tearDown() */
044    @Override
045    protected void tearDown() throws Exception {
046        FileUtils.deleteDirectory(getTestDirectory());
047    }
048
049    //-----------------------------------------------------------------------
050    public void testWaitFor() {
051        FileUtils.waitFor(new File(""), -1);
052        FileUtils.waitFor(new File(""), 2);
053    }
054
055}