@Override
    public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
        try {
            final FileEntity entity = new FilesApi(new BrickApiClient(session))
                    .download(StringUtils.removeStart(file.getAbsolute(), String.valueOf(Path.DELIMITER)),
                            "stat", null, false, false);
            switch(entity.getType()) {
                case "file":
                    if(file.isDirectory()) {
                        throw new NotfoundException(file.getAbsolute());
                    }
                    break;
                case "directory":
                    if(file.isFile()) {
                        throw new NotfoundException(file.getAbsolute());
                    }
            }
            return this.toAttributes(entity);
        }
        catch(ApiException e) {
            throw new BrickExceptionMappingService().map("Failure to read attributes of {0}", e, file);
        }
    }
@Test(expected = NotfoundException.class)
    public void testFindNotFound() throws Exception {
        final Path folder = new BrickDirectoryFeature(session).mkdir(
            new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        final Path test = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        final BrickAttributesFinderFeature f = new BrickAttributesFinderFeature(session);
        try {
            f.find(test);
        }
        finally {
            new BrickDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        }
    }