@Override
    protected String query(final Path directory, final ListProgressListener listener) throws BackgroundException {
        // The contains operator only performs prefix matching for a name.
        return String.format("name contains '%s'", query);
    }
@Test
    public void testQuery() throws Exception {
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        final Path directory = new DriveDirectoryFeature(session, fileid).mkdir(new Path(DriveHomeFinderService.MYDRIVE_FOLDER, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        final String name = new AlphanumericRandomStringService().random();
        final Drive.Files.Create insert = session.getClient().files().create(new File()
                .setName(name)
                .setParents(Collections.singletonList(fileid.getFileId(directory))));
        final File execute = insert.execute();
        execute.setVersion(1L);
        final Path file = new Path(directory, name, EnumSet.of(Path.Type.file), new DriveAttributesFinderFeature(session, fileid).toAttributes(execute));
        {
            final Path subdirectory = new DriveDirectoryFeature(session, fileid).mkdir(new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
            assertTrue(new DriveSearchListService(session, fileid, name).list(subdirectory, new DisabledListProgressListener()).isEmpty());
            new DriveDeleteFeature(session, fileid).delete(Collections.singletonList(subdirectory), new DisabledPasswordCallback(), new Delete.DisabledCallback());
        }
        {
            final AttributedList<Path> list = new DriveSearchListService(session, fileid, name).list(DriveHomeFinderService.MYDRIVE_FOLDER, new DisabledListProgressListener());
            assertEquals(1, list.size());
            assertEquals(file, list.get(0));
        }
        {
            assertTrue(new DriveSearchListService(session, fileid, name).list(DriveHomeFinderService.SHARED_FOLDER_NAME, new DisabledListProgressListener()).isEmpty());
        }
        {
            final AttributedList<Path> list = new DriveSearchListService(session, fileid, name).list(directory, new DisabledListProgressListener());
            assertEquals(1, list.size());
            assertEquals(file, list.get(0));
        }
        new DriveDeleteFeature(session, fileid).delete(Arrays.asList(file, directory), new DisabledPasswordCallback(), new Delete.DisabledCallback());
    }