### Question:
ProcessDatastore extends CommonDatastore<ProcessItem, ProcessDeploymentInfo> implements
        DatastoreHasAdd<ProcessItem>,
        DatastoreHasUpdate<ProcessItem>,
        DatastoreHasGet<ProcessItem>,
        DatastoreHasSearch<ProcessItem>,
        DatastoreHasDelete { @Override public ProcessItem add(final ProcessItem process) { final ProcessEngineClient engineClient = getProcessEngineClient(); File processFile; try { processFile = getTenantFolder().getTempFile(process.getAttributes().get(FILE_UPLOAD), getEngineSession().getTenantId()); } catch (final UnauthorizedFolderException e) { throw new APIForbiddenException(e.getMessage()); } catch (final IOException e) { throw new APIException(e); } final BusinessArchive businessArchive = readBusinessArchive(processFile); final ProcessDefinition deployedArchive = engineClient.deploy(businessArchive); final ProcessDeploymentInfo processDeploymentInfo = engineClient.getProcessDeploymentInfo(deployedArchive.getId()); try { FormsResourcesUtils.retrieveApplicationFiles( getEngineSession(), processDeploymentInfo.getProcessId(), processDeploymentInfo.getDeploymentDate()); } catch (final IOException e) { throw new APIException("", e); } catch (final ProcessDefinitionNotFoundException e) { throw new APIException("", e); } catch (final BPMEngineException e) { throw new APIException("", e); } return convertEngineToConsoleItem(processDeploymentInfo); } ProcessDatastore(final APISession engineSession); @Override ProcessItem add(final ProcessItem process); @Override ProcessItem update(final APIID id, final Map<String, String> attributes); @Override ProcessItem get(final APIID id); @Override void delete(final List<APIID> ids); @Override ItemSearchResult<ProcessItem> search(final int page, final int resultsByPage, final String search, final String orders,
            final Map<String, String> filters);  }### Answer:
@Test(expected = APIForbiddenException.class) public void it_throws_an_exception_adding_a_bar_file_with_unauthorized_path() throws IOException { doThrow(new UnauthorizedFolderException("")).when(tenantFolder).getTempFile(any(String.class), any(Long.class)); processDatastore.add(processItem); }
@Test(expected = APIException.class) public void it_throws_an_exception_adding_a_bar_file_with_ioException() throws IOException { doThrow(new IOException("")).when(tenantFolder).getTempFile(any(String.class), any(Long.class)); try { processDatastore.add(processItem); } catch (final APIForbiddenException e) { fail("Exception is not supposed to be an APIForbiddenException"); } }