DirectoryEntryTest.groovy revision 09415075d96852489d096aea7ae07dd156b58643
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 */
16package org.mockftpserver.fake.filesystem
17
18/**
19 * Tests for DirectoryEntry
20 *
21 * @version $Revision$ - $Date$
22 *
23 * @author Chris Mair
24 */
25public class DirectoryEntryTest extends AbstractFileSystemEntryTest {
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.directory
43    }
44
45    /**
46     * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTest#getImplementationClass()
47     */
48    protected Class getImplementationClass() {
49        return DirectoryEntry.class
50    }
51
52    /**
53     * @see org.mockftpserver.fake.filesystem.AbstractFileSystemEntryTest#isDirectory()
54     */
55    protected boolean isDirectory() {
56        return true
57    }
58
59    void setUp() {
60        super.setUp()
61        entry = new DirectoryEntry(PATH)
62    }
63
64}
65