@Test public void testNewInstance() { assertNull( AndDependencySelector.newInstance( null, null ) ); DependencySelector selector = new DummyDependencySelector(); assertSame( selector, AndDependencySelector.newInstance( selector, null ) ); assertSame( selector, AndDependencySelector.newInstance( null, selector ) ); assertSame( selector, AndDependencySelector.newInstance( selector, selector ) ); assertNotNull( AndDependencySelector.newInstance( selector, new DummyDependencySelector() ) ); }
public static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ) { if ( selector1 == null ) { return selector2; } else if ( selector2 == null || selector2.equals( selector1 ) ) { return selector1; } return new AndDependencySelector( selector1, selector2 ); }
AndDependencySelector implements DependencySelector { public static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ) { if ( selector1 == null ) { return selector2; } else if ( selector2 == null || selector2.equals( selector1 ) ) { return selector1; } return new AndDependencySelector( selector1, selector2 ); } }
AndDependencySelector implements DependencySelector { public static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ) { if ( selector1 == null ) { return selector2; } else if ( selector2 == null || selector2.equals( selector1 ) ) { return selector1; } return new AndDependencySelector( selector1, selector2 ); } AndDependencySelector( DependencySelector... selectors );  AndDependencySelector( Collection<? extends DependencySelector> selectors ); private  AndDependencySelector( Set<DependencySelector> selectors ); }
AndDependencySelector implements DependencySelector { public static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ) { if ( selector1 == null ) { return selector2; } else if ( selector2 == null || selector2.equals( selector1 ) ) { return selector1; } return new AndDependencySelector( selector1, selector2 ); } 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 { public static DependencySelector newInstance( DependencySelector selector1, DependencySelector selector2 ) { if ( selector1 == null ) { return selector2; } else if ( selector2 == null || selector2.equals( selector1 ) ) { return selector1; } return new AndDependencySelector( selector1, selector2 ); } 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();  }