@Test(groups = "conn", dataProvider = "urls") public void iterator(final String actual, final LdapURL[] expected) { final ActivePassiveConnectionStrategy strategy = new ActivePassiveConnectionStrategy(); strategy.initialize(actual, ldapURL -> true); Assert.assertEquals( StreamSupport.stream(strategy.spliterator(), false).collect(Collectors.toList()), Arrays.asList(expected)); Assert.assertEquals( StreamSupport.stream(strategy.spliterator(), false).collect(Collectors.toList()), Arrays.asList(expected)); Assert.assertEquals( StreamSupport.stream(strategy.spliterator(), false).collect(Collectors.toList()), Arrays.asList(expected)); Assert.assertEquals( StreamSupport.stream(strategy.spliterator(), false).collect(Collectors.toList()), Arrays.asList(expected)); Assert.assertEquals( StreamSupport.stream(strategy.spliterator(), false).collect(Collectors.toList()), Arrays.asList(expected)); }
@Override public Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(ldapURLSet.getUrls()); }
ActivePassiveConnectionStrategy extends AbstractConnectionStrategy { @Override public Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(ldapURLSet.getUrls()); } }
ActivePassiveConnectionStrategy extends AbstractConnectionStrategy { @Override public Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(ldapURLSet.getUrls()); } ActivePassiveConnectionStrategy();  ActivePassiveConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); }
ActivePassiveConnectionStrategy extends AbstractConnectionStrategy { @Override public Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(ldapURLSet.getUrls()); } ActivePassiveConnectionStrategy();  ActivePassiveConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); @Override Iterator<LdapURL> iterator(); }
ActivePassiveConnectionStrategy extends AbstractConnectionStrategy { @Override public Iterator<LdapURL> iterator() { if (!isInitialized()) { throw new IllegalStateException("Strategy is not initialized"); } if (iterFunction != null) { return iterFunction.apply(ldapURLSet.getUrls()); } return new DefaultLdapURLIterator(ldapURLSet.getUrls()); } ActivePassiveConnectionStrategy();  ActivePassiveConnectionStrategy(final Function<List<LdapURL>, Iterator<LdapURL>> function); @Override Iterator<LdapURL> iterator();  }