|
20 | 20 | import static java.nio.charset.StandardCharsets.UTF_8; |
21 | 21 |
|
22 | 22 | import com.google.cloud.storage.StorageOptions; |
23 | | -import com.google.common.collect.ImmutableList; |
24 | 23 | import com.google.common.testing.EqualsTester; |
25 | 24 | import com.google.common.testing.NullPointerTester; |
26 | 25 |
|
@@ -166,18 +165,18 @@ public void testListFiles() throws IOException { |
166 | 165 | public void testMatcher() throws IOException { |
167 | 166 | try (FileSystem fs = CloudStorageFileSystem.forBucket("bucket")) { |
168 | 167 | String pattern1 = "glob:*.java"; |
169 | | - PathMatcher matcher1 = fs.getPathMatcher(pattern1); |
| 168 | + PathMatcher javaFileMatcher = fs.getPathMatcher(pattern1); |
| 169 | + assertMatches(fs, javaFileMatcher, "a.java", true); |
| 170 | + assertMatches(fs, javaFileMatcher, "a.text", false); |
| 171 | + assertMatches(fs, javaFileMatcher, "folder/c.java", true); |
| 172 | + assertMatches(fs, javaFileMatcher, "d", false); |
| 173 | + |
170 | 174 | String pattern2 = "glob:*.{java,text}"; |
171 | | - PathMatcher matcher2 = fs.getPathMatcher(pattern2); |
172 | | - |
173 | | - assertMatches(fs, matcher1, "a.java", true); |
174 | | - assertMatches(fs, matcher1, "a.text", false); |
175 | | - assertMatches(fs, matcher1, "folder/c.java", true); |
176 | | - assertMatches(fs, matcher1, "d", false); |
177 | | - assertMatches(fs, matcher2, "a.java", true); |
178 | | - assertMatches(fs, matcher2, "a.text", true); |
179 | | - assertMatches(fs, matcher2, "folder/c.java", true); |
180 | | - assertMatches(fs, matcher2, "d", false); |
| 175 | + PathMatcher javaAndTextFileMatcher = fs.getPathMatcher(pattern2); |
| 176 | + assertMatches(fs, javaAndTextFileMatcher, "a.java", true); |
| 177 | + assertMatches(fs, javaAndTextFileMatcher, "a.text", true); |
| 178 | + assertMatches(fs, javaAndTextFileMatcher, "folder/c.java", true); |
| 179 | + assertMatches(fs, javaAndTextFileMatcher, "d", false); |
181 | 180 | } |
182 | 181 | } |
183 | 182 |
|
|
0 commit comments