### Question:
FilePluginInstaller implements RevertablePluginInstaller { public void revertInstalledPlugin(String pluginKey) { OriginalFile orig = installedPlugins.get(pluginKey); if (orig != null) { File origFile = new File(orig.getBackupFile().getParent(), orig.getOriginalName()); if (origFile.exists()) { origFile.delete(); } if (orig.isUpgrade()) { try { FileUtils.moveFile(orig.getBackupFile(), origFile); } catch (IOException e) { log.warn("Unable to restore old plugin for " + pluginKey); } } } } FilePluginInstaller(File directory); void installPlugin(String key, PluginArtifact pluginArtifact); void revertInstalledPlugin(String pluginKey); void clearBackups(); static final String ORIGINAL_PREFIX; }### Answer:
@Test public void testRevertInstalledPlugin() throws IOException { FilePluginInstaller installer = new FilePluginInstaller(pluginDir); File pluginFile = File.createTempFile("plugin", ".jar", tmpDir); installer.installPlugin("foo", new XmlPluginArtifact(pluginFile)); installer.revertInstalledPlugin("foo"); assertFalse(new File(pluginDir, pluginFile.getName()).exists()); }