GcsFileSystem extends FileSystem<GcsResourceId> { @VisibleForTesting MatchResult expand(GcsPath gcsPattern) throws IOException { String prefix = GcsUtil.getNonWildcardPrefix(gcsPattern.getObject()); Pattern p = Pattern.compile(wildcardToRegexp(gcsPattern.getObject())); LOG.debug( "matching files in bucket {}, prefix {} against pattern {}", gcsPattern.getBucket(), prefix, p.toString()); String pageToken = null; List<Metadata> results = new ArrayList<>(); do { Objects objects = options.getGcsUtil().listObjects(gcsPattern.getBucket(), prefix, pageToken); if (objects.getItems() == null) { break; } for (StorageObject o : objects.getItems()) { String name = o.getName(); if (p.matcher(name).matches() && !name.endsWith("/")) { LOG.debug("Matched object: {}", name); results.add(toMetadata(o)); } } pageToken = objects.getNextPageToken(); } while (pageToken != null); return MatchResult.create(Status.OK, results); } GcsFileSystem(GcsOptions options);   }
@Test public void testExpandNonGlob() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Glob expression: [testdirectory/otherfile] is not expandable."); gcsFileSystem.expand(GcsPath.fromUri("gs: }