Home | History | Annotate | Download | only in filesystem
      1 /*
      2  * Copyright 2008 the original author or authors.
      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 package org.mockftpserver.fake.filesystem
     17 
     18 /**
     19  * Tests for DirectoryEntry
     20  *
     21  * @version $Revision$ - $Date$
     22  *
     23  * @author Chris Mair
     24  */
     25 public class DirectoryEntryTest extends AbstractFileSystemEntryTestCase {
     26 
     27     private DirectoryEntry entry
     28 
     29     void testCloneWithNewPath() {
     30         entry.lastModified = LAST_MODIFIED
     31         entry.owner = USER
     32         entry.group = GROUP
     33         entry.permissions = PERMISSIONS
     34         def clone = entry.cloneWithNewPath(NEW_PATH)
     35 
     36         assert !clone.is(entry)
     37         assert clone.path == NEW_PATH
     38         assert clone.lastModified == LAST_MODIFIED
     39         assert clone.owner == USER
     40         assert clone.group == GROUP
     41         assert clone.permissions == PERMISSIONS
     42         assert clone.size == 0
     43         assert clone.directory
     44     }
     45 
     46     /**
     47      * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTestCase#getImplementationClass()
     48      */
     49     protected Class getImplementationClass() {
     50         return DirectoryEntry.class
     51     }
     52 
     53     /**
     54      * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTestCase#isDirectory()
     55      */
     56     protected boolean isDirectory() {
     57         return true
     58     }
     59 
     60     void setUp() {
     61         super.setUp()
     62         entry = new DirectoryEntry(PATH)
     63     }
     64 
     65 }
     66