chrismair | 00dc7bd | 2014-05-11 21:21:28 +0000 | [diff] [blame] | 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 | * Test-only subclass of UnixFakeFileSystem. Groovy implementation enables access to metaclass.
|
| 20 | *
|
| 21 | * @version $Revision$ - $Date$
|
| 22 | *
|
| 23 | * @author Chris Mair
|
| 24 | */
|
| 25 | class TestUnixFakeFileSystem extends UnixFakeFileSystem {
|
| 26 |
|
| 27 | Throwable addMethodException
|
| 28 | Throwable renameMethodException
|
| 29 | Throwable listNamesMethodException
|
| 30 | Throwable listFilesMethodException
|
| 31 | Throwable deleteMethodException
|
| 32 |
|
| 33 | void add(FileSystemEntry entry) {
|
| 34 | if (addMethodException) {
|
| 35 | throw addMethodException
|
| 36 | }
|
| 37 | super.add(entry)
|
| 38 | }
|
| 39 |
|
| 40 | void rename(String fromPath, String toPath) {
|
| 41 | if (renameMethodException) {
|
| 42 | throw renameMethodException
|
| 43 | }
|
| 44 | super.rename(fromPath, toPath)
|
| 45 | }
|
| 46 |
|
| 47 | List listNames(String path) {
|
| 48 | if (listNamesMethodException) {
|
| 49 | throw listNamesMethodException
|
| 50 | }
|
| 51 | super.listNames(path)
|
| 52 | }
|
| 53 |
|
| 54 | List listFiles(String path) {
|
| 55 | if (listFilesMethodException) {
|
| 56 | throw listFilesMethodException
|
| 57 | }
|
| 58 | super.listFiles(path)
|
| 59 | }
|
| 60 |
|
| 61 | boolean delete(String path) {
|
| 62 | if (deleteMethodException) {
|
| 63 | throw deleteMethodException
|
| 64 | }
|
| 65 | super.delete(path)
|
| 66 | }
|
| 67 |
|
| 68 | } |