Aurimas Liutikas | 93554f2 | 2022-04-19 16:51:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 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 | |
| 17 | package mypackage; |
| 18 | |
| 19 | import java.io.IOException; |
| 20 | import java.net.URI; |
| 21 | import java.nio.file.FileStore; |
| 22 | import java.nio.file.FileSystem; |
| 23 | import java.nio.file.Path; |
| 24 | import java.nio.file.PathMatcher; |
| 25 | import java.nio.file.WatchService; |
| 26 | import java.nio.file.attribute.UserPrincipalLookupService; |
| 27 | import java.nio.file.spi.FileSystemProvider; |
| 28 | import java.util.Map; |
| 29 | import java.util.Set; |
| 30 | |
| 31 | public class MockFileSystem extends FileSystem { |
| 32 | private URI uri; |
| 33 | private Map<String, ?> env; |
| 34 | private Path path; |
| 35 | |
| 36 | public MockFileSystem(URI uri, Map<String, ?> env) { |
| 37 | this.uri = uri; |
| 38 | this.env = env; |
| 39 | } |
| 40 | |
| 41 | public MockFileSystem(Path path, Map<String, ?> env) { |
| 42 | this.path = path; |
| 43 | this.env = env; |
| 44 | } |
| 45 | |
| 46 | public URI getURI() { |
| 47 | return uri; |
| 48 | } |
| 49 | |
| 50 | public Path getPath() { |
| 51 | return path; |
| 52 | } |
| 53 | |
| 54 | public Map<String, ?> getEnv() { |
| 55 | return env; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public FileSystemProvider provider() { |
| 60 | return null; |
| 61 | } |
| 62 | |
| 63 | @Override |
| 64 | public void close() throws IOException { |
| 65 | |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public boolean isOpen() { |
| 70 | return false; |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public boolean isReadOnly() { |
| 75 | return false; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public String getSeparator() { |
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public Iterable<Path> getRootDirectories() { |
| 85 | return null; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public Iterable<FileStore> getFileStores() { |
| 90 | return null; |
| 91 | } |
| 92 | |
| 93 | @Override |
| 94 | public Set<String> supportedFileAttributeViews() { |
| 95 | return null; |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | public Path getPath(String first, String... more) { |
| 100 | return null; |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public PathMatcher getPathMatcher(String syntaxAndPattern) { |
| 105 | return null; |
| 106 | } |
| 107 | |
| 108 | @Override |
| 109 | public UserPrincipalLookupService getUserPrincipalLookupService() { |
| 110 | return null; |
| 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public WatchService newWatchService() throws IOException { |
| 115 | return null; |
| 116 | } |
| 117 | } |