@Test public void testEquals() { DependencySelector other1 = new DummyDependencySelector( true ); DependencySelector other2 = new DummyDependencySelector( false ); DependencySelector selector1 = new AndDependencySelector( other1, other2 ); DependencySelector selector2 = new AndDependencySelector( other2, other1 ); DependencySelector selector3 = new AndDependencySelector( other1 ); assertEquals( selector1, selector1 ); assertEquals( selector1, selector2 ); assertNotEquals( selector1, selector3 ); assertNotEquals( selector1, this ); assertNotEquals( selector1, null ); }
@Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } else if ( null == obj || !getClass().equals( obj.getClass() ) ) { return false; } AndDependencySelector that = (AndDependencySelector) obj; return selectors.equals( that.selectors ); }
AndDependencySelector implements DependencySelector { @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } else if ( null == obj || !getClass().equals( obj.getClass() ) ) { return false; } AndDependencySelector that = (AndDependencySelector) obj; return selectors.equals( that.selectors ); } }
AndDependencySelector implements DependencySelector { @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } else if ( null == obj || !getClass().equals( obj.getClass() ) ) { return false; } AndDependencySelector that = (AndDependencySelector) obj; return selectors.equals( that.selectors ); } AndDependencySelector( DependencySelector... selectors );  AndDependencySelector( Collection<? extends DependencySelector> selectors ); private  AndDependencySelector( Set<DependencySelector> selectors ); }
AndDependencySelector implements DependencySelector { @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } else if ( null == obj || !getClass().equals( obj.getClass() ) ) { return false; } AndDependencySelector that = (AndDependencySelector) obj; return selectors.equals( that.selectors ); } AndDependencySelector( DependencySelector... selectors );  AndDependencySelector( Collection<? extends DependencySelector> selectors ); private  AndDependencySelector( Set<DependencySelector> selectors ); static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ); boolean selectDependency( Dependency dependency ); DependencySelector deriveChildSelector( DependencyCollectionContext context ); @Override boolean equals( Object obj ); @Override int hashCode(); }
AndDependencySelector implements DependencySelector { @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } else if ( null == obj || !getClass().equals( obj.getClass() ) ) { return false; } AndDependencySelector that = (AndDependencySelector) obj; return selectors.equals( that.selectors ); } AndDependencySelector( DependencySelector... selectors );  AndDependencySelector( Collection<? extends DependencySelector> selectors ); private  AndDependencySelector( Set<DependencySelector> selectors ); static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ); boolean selectDependency( Dependency dependency ); DependencySelector deriveChildSelector( DependencyCollectionContext context ); @Override boolean equals( Object obj ); @Override int hashCode();  }