### Question:
AbstractPlugin implements Plugin, Comparable<Plugin> { public int compareTo(final Plugin otherPlugin) { if (otherPlugin.getKey() == null) { if (getKey() == null) { return 0; } return 1; } if (getKey() == null) { return -1; } if (!otherPlugin.getKey().equals(getKey())) { return getKey().compareTo(otherPlugin.getKey()); } final String thisVersion = cleanVersionString((getPluginInformation() != null ? getPluginInformation().getVersion() : null)); final String otherVersion = cleanVersionString((otherPlugin.getPluginInformation() != null ? otherPlugin.getPluginInformation().getVersion() : null)); if (!VersionStringComparator.isValidVersionString(thisVersion)) { if (!VersionStringComparator.isValidVersionString(otherVersion)) { return 0; } return -1; } if (!VersionStringComparator.isValidVersionString(otherVersion)) { return 1; } return new VersionStringComparator().compare(thisVersion, otherVersion); }  String getName(); void setName(final String name); String getI18nNameKey(); void setI18nNameKey(final String i18nNameKey); String getKey(); void setKey(final String aPackage); void addModuleDescriptor(final ModuleDescriptor<?> moduleDescriptor); Collection<ModuleDescriptor<?>> getModuleDescriptors(); ModuleDescriptor<?> getModuleDescriptor(final String key); List<ModuleDescriptor<T>> getModuleDescriptorsByModuleClass(final Class<T> aClass); PluginState getPluginState(); boolean isEnabledByDefault(); void setEnabledByDefault(final boolean enabledByDefault); int getPluginsVersion(); void setPluginsVersion(final int pluginsVersion); PluginInformation getPluginInformation(); void setPluginInformation(final PluginInformation pluginInformation); void setResources(final Resourced resources); List<ResourceDescriptor> getResourceDescriptors(); List<ResourceDescriptor> getResourceDescriptors(final String type); ResourceLocation getResourceLocation(final String type, final String name); @Deprecated ResourceDescriptor getResourceDescriptor(final String type, final String name); @Deprecated boolean isEnabled(); final void enable(); final void disable(); Set<String> getRequiredPlugins(); void close(); final void install(); final void uninstall(); @Deprecated void setEnabled(final boolean enabled); boolean isSystemPlugin(); boolean containsSystemModule(); void setSystemPlugin(final boolean system); Date getDateLoaded(); boolean isBundledPlugin(); int compareTo(final Plugin otherPlugin); @Override String toString();  }### Answer:
@Test public void testCompareTo() { final AbstractPlugin p1 = createAbstractPlugin(); p1.setKey("foo"); final AbstractPlugin p2 = createAbstractPlugin(); p2.setKey("bar"); assertTrue(p1.compareTo(p2) > 0); assertTrue(p2.compareTo(p1) < 0); }