@Override
    public Path mkdir(final Path folder, final TransferStatus status) throws BackgroundException {
        try {
            return folder.withAttributes(new BoxAttributesFinderFeature(session, fileid).toAttributes(
                    new FoldersApi(new BoxApiClient(session.getClient())).postFolders(new FoldersBody()
                            .parent(new FoldersParent().id(fileid.getFileId(folder.getParent())))
                            .name(folder.getName()), Collections.emptyList())));
        }
        catch(ApiException e) {
            throw new BoxExceptionMappingService(fileid).map("Cannot create folder {0}", e, folder);
        }
    }
@Test
    public void testCreateDirectory() throws Exception {
        final BoxFileidProvider fileid = new BoxFileidProvider(session);
        final Path folder = new BoxDirectoryFeature(session, fileid).mkdir(
                new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        assertTrue(new DefaultFindFeature(session).find(folder));
        assertTrue(new BoxFindFeature(session, fileid).find(folder));
        assertEquals(0L, folder.attributes().getSize());
        assertNotEquals(-1L, folder.attributes().getModificationDate());
        assertThrows(ConflictException.class, () -> new BoxDirectoryFeature(session, fileid).mkdir(folder, new TransferStatus()));
        new BoxDeleteFeature(session, fileid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new DefaultFindFeature(session).find(folder));
    }