### Question:
ApplicationsImportService extends BonitaImportService { @Override public ImportStatusMessages importFileContent(final byte[] fileContent, final String importPolicyAsString) throws ExecutionException, ImportException, AlreadyExistsException, InvalidSessionException, BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { final ApplicationImportPolicy importPolicy = ApplicationImportPolicy.valueOf(importPolicyAsString); final List<ImportStatus> ImportStatusList = getApplicationAPI().importApplications(fileContent, importPolicy); return new ImportStatusMessages(ImportStatusList); }  @Override String getToken(); @Override String getFileUploadParamName(); @Override ImportStatusMessages importFileContent(final byte[] fileContent, final String importPolicyAsString); final static String TOKEN; static final String FILE_UPLOAD; }### Answer:
@Test public void should_importFileContent_call_ApplicationAPI_with_valid_param() throws Exception { spiedApplicationImportService.importFileContent(new byte[0], "FAIL_ON_DUPLICATES"); verify(applicationAPI).importApplications(new byte[0], ApplicationImportPolicy.FAIL_ON_DUPLICATES); }
@Test public void should_importFileContent_return_ImportStatusMessages() throws Exception { final ArrayList<ImportStatus> statusList = new ArrayList<ImportStatus>(); statusList.add(new ImportStatus("status")); doReturn(statusList).when(applicationAPI).importApplications(new byte[0], ApplicationImportPolicy.FAIL_ON_DUPLICATES); final ImportStatusMessages importStatusMessages = spiedApplicationImportService.importFileContent(new byte[0], "FAIL_ON_DUPLICATES"); assertEquals(importStatusMessages.getImported().size(), 1); }
@Test(expected = IllegalArgumentException.class) public void should_importFileContent_with_invalid_policy_throw_error() throws Exception { spiedApplicationImportService.importFileContent(new byte[0], "NOT_AUTHORIZED_POLICY"); }