@Override
    public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
        if(file.isRoot()) {
            return PathAttributes.EMPTY;
        }
        if(new DefaultPathContainerService().isContainer(file)) {
            return PathAttributes.EMPTY;
        }
        final Path query;
        if(file.isPlaceholder()) {
            query = new Path(file.getParent(), FilenameUtils.removeExtension(file.getName()), file.getType(), file.attributes());
        }
        else {
            query = file;
        }
        final AttributedList<Path> list;
        if(new SimplePathPredicate(DriveHomeFinderService.SHARED_DRIVES_NAME).test(file.getParent())) {
            list = new DriveTeamDrivesListService(session, fileid).list(file.getParent(), listener);
        }
        else {
            list = new FileidDriveListService(session, fileid, query).list(file.getParent(), listener);
        }
        final Path found = list.find(new ListFilteringFeature.ListFilteringPredicate(session.getCaseSensitivity(), file));
        if(null == found) {
            throw new NotfoundException(file.getAbsolute());
        }
        return found.attributes();

    }
@Test
    public void testDuplicatesWithSameName() throws Exception {
        final DriveFileIdProvider fileid = new DriveFileIdProvider(session);
        final Path folder = 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 Path version1 = new DriveTouchFeature(session, fileid).touch(
                new Path(folder, name, EnumSet.of(Path.Type.file)), new TransferStatus());
        final DriveAttributesFinderFeature f = new DriveAttributesFinderFeature(session, fileid);
        assertEquals(version1.attributes(), f.find(version1));
        final AttributedList<Path> listBeforeDelete = new DriveListService(session, fileid).list(folder, new DisabledListProgressListener());
        assertTrue(listBeforeDelete.contains(version1));
        assertFalse(listBeforeDelete.find(new DefaultPathPredicate(version1)).attributes().isHidden());
        new DriveTrashFeature(session, fileid).delete(Collections.singletonList(new Path(version1)), new DisabledLoginCallback(), new Delete.DisabledCallback());
        final AttributedList<Path> listAfterDelete = new DriveListService(session, fileid).list(folder, new DisabledListProgressListener());
        assertTrue(listAfterDelete.contains(version1));
        assertTrue(listAfterDelete.find(new DefaultPathPredicate(version1)).attributes().isHidden());
        final Path version2 = new DriveTouchFeature(session, fileid).touch(
                new Path(folder, name, EnumSet.of(Path.Type.file)), new TransferStatus());
        assertNotEquals(f.find(version1), f.find(version2));
        final AttributedList<Path> listAfterReupload = new DriveListService(session, fileid).list(folder, new DisabledListProgressListener());
        assertTrue(listAfterReupload.contains(version2));
        assertFalse(listAfterReupload.find(new DefaultPathPredicate(version2)).attributes().isHidden());
        new DriveDeleteFeature(session, fileid).delete(Arrays.asList(version1, version2, folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }