AbstractPlugin extends AbstractBean implements SuccessInterface, Comparable<AbstractPlugin>, Serializable { @Override public boolean equals( final Object o ) { boolean result = false; if ( o instanceof AbstractPlugin ) { result = ( (AbstractPlugin) o ).getName().equals( this.getName() ); } return result; } AbstractPlugin(); ImageIcon getIcon(); void setIcon( ImageIcon icon ); void setMaxPoints( int maxPoints ); abstract void initializePlugin(); String getName(); void setName( final String name ); String getDescription(); void setDescription( final String description ); String getAuthor(); void setAuthor( final String author ); String getVersion(); void setVersion( final String version ); final PluginOptionContainer getPluginOptions(); int getMaxPoints(); final int getCurrentPoints(); final PluginState getState(); final boolean isRunning(); final boolean isReady(); final boolean isFinished(); final boolean isFailed(); final boolean isAborting(); final boolean isStopped(); final boolean startAttack(); abstract void clean(); final void abortAttack(); final void stopAttack(); abstract boolean wasSuccessful(); PluginFunctionInterface[] getPluginFunctions(); void setPluginFunctions( PluginFunctionInterface[] pluginFunctions ); PluginFunctionInterface getPluginFunctions( int index ); void setPluginFunctions( int index, PluginFunctionInterface newPluginFunctions ); final void addPluginObserver( final PluginObserver o ); final void removePluginObserver( final PluginObserver o ); void restoreConfiguration( AbstractPlugin plugin ); String[] getCategory(); void setCategory( String[] category ); String getCategory( int index ); void setCategory( int index, String newCategory ); @Override boolean equals( final Object o ); @Override int hashCode(); @Override int compareTo( final AbstractPlugin p ); @Override String toString(); static final String PROP_NAME; static final String PROP_DESCRIPTION; static final String PROP_CATEGORY; static final String PROP_CURRENT_POINTS; static final String PROP_MAXPOINTS; static final String PROP_STATE; static final String PROP_VERSION; static final String PROP_AUTHOR; static final String PROP_PLUGINFUNCTIONS; static final String PROP_ICON; }
@Test public void testEquals() { AbstractPlugin a1 = new NullPlugin( "a" ); AbstractPlugin a2 = new NullPlugin( "a" ); AbstractPlugin b = new NullPlugin( "b" ); assertTrue( a1.equals( a1 ) ); assertTrue( a2.equals( a2 ) ); assertTrue( b.equals( b ) ); assertFalse( a1 == a2 ); assertTrue( a1.equals( a2 ) ); assertFalse( a1.equals( b ) ); assertFalse( a2.equals( b ) ); }