### Question:
FilePluginInstaller implements RevertablePluginInstaller { public void clearBackups() { for (File file : directory.listFiles(new BackupNameFilter())) { file.delete(); } installedPlugins.clear(); } FilePluginInstaller(File directory); void installPlugin(String key, PluginArtifact pluginArtifact); void revertInstalledPlugin(String pluginKey); void clearBackups(); static final String ORIGINAL_PREFIX; }### Answer:
@Test public void testClearBackups() throws IOException { FilePluginInstaller installer = new FilePluginInstaller(pluginDir); File pluginFile = File.createTempFile("plugin", ".jar", pluginDir); FileUtils.writeStringToFile(pluginFile, "foo"); File upgradedFile = new File(tmpDir, pluginFile.getName()); FileUtils.writeStringToFile(upgradedFile, "bar"); installer.installPlugin("foo", new XmlPluginArtifact(upgradedFile)); assertTrue(new File(pluginDir, FilePluginInstaller.ORIGINAL_PREFIX + pluginFile.getName()).exists()); installer.clearBackups(); assertTrue(pluginFile.exists()); assertFalse(new File(pluginDir, FilePluginInstaller.ORIGINAL_PREFIX + pluginFile.getName()).exists()); }