OrnidroidIOServiceImpl implements IOrnidroidIOService { public void removeCustomMediaFile(final OrnidroidFile ornidroidFile) throws OrnidroidException { if (null != ornidroidFile && ornidroidFile.isCustomMediaFile()) { final File mediaFile = new File(ornidroidFile.getPath()); final File mediaPropertiesFile = new File(ornidroidFile.getPath() + OrnidroidFile.PROPERTIES_SUFFIX); try { FileHelper.forceDelete(mediaFile); FileHelper.forceDelete(mediaPropertiesFile); } catch (final IOException e) { Log.e(BasicConstants.LOG_TAG, e.getMessage(), e); throw new OrnidroidException( OrnidroidError.ADD_CUSTOM_MEDIA_ERROR, e); } } } OrnidroidIOServiceImpl(); void addCustomMediaFile(final String birdDirectory,
			final OrnidroidFileType fileType, final String selectedFileName,
			final File selectedFile, final String comment); void checkAndCreateDirectory(final File fileDirectory); void checkOrnidroidHome(final String ornidroidHome); void downloadMediaFiles(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); List<String> filesToUpdate(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); void loadMediaFiles(final String fileDirectory, final Bird bird,
			final OrnidroidFileType fileType); void removeCustomMediaFile(final OrnidroidFile ornidroidFile); @Override void resetExistingDirectory(File directoryToReset); void downloadZipPackage(String zipname, String mediaHomeDirectory); boolean isEnoughFreeSpace(OrnidroidFileType fileType); ZipPackage getZipname(OrnidroidFileType fileType); int getZipDownloadProgressPercent(OrnidroidFileType fileType,
			int folderSizeBeforeDownload); int getInstallProgressPercent(OrnidroidFileType fileType);  }
@Test public void testRemoveCustomMediaFile() throws OrnidroidException, IOException { final File srcDir = buildOrnidroidHomeTest(TEST_DIRECTORY + "/srcDir"); final File imagesDir = new File(srcDir.getAbsolutePath() + File.separator + Constants.IMAGES_DIRECTORY); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + BasicConstants.CUSTOM_MEDIA_FILE_PREFIX + "file1.jpg")); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + BasicConstants.CUSTOM_MEDIA_FILE_PREFIX + "file1.jpg.properties")); final OrnidroidFileFactoryImpl factory = OrnidroidFileFactoryImpl .getFactory(); final OrnidroidFile officialOrnidroidFile = factory .createOrnidroidFile( imagesDir.getAbsolutePath() + "/file1.jpg", OrnidroidFileType.PICTURE, SupportedLanguage.ENGLISH.getCode()); final OrnidroidFile customOrnidroidFile = factory.createOrnidroidFile( imagesDir.getAbsolutePath() + "/custom_file1.jpg", OrnidroidFileType.PICTURE, SupportedLanguage.ENGLISH.getCode()); Assert.assertEquals( "there should be 4 files in the test directory : file1.jpg, custom_file1.jpg and their properties files", 4, imagesDir.list().length); this.ornidroidIOService.removeCustomMediaFile(officialOrnidroidFile); Assert.assertEquals( "there should be still 4 files in the test directory : file1.jpg, custom_file1.jpg and their properties files", 4, imagesDir.list().length); this.ornidroidIOService.removeCustomMediaFile(customOrnidroidFile); Assert.assertEquals( "there should be 2 files in the test directory : file1.jpg, and its properties file", 2, imagesDir.list().length); }