@Test(groups = "conn", dataProvider = "urls") public void hasNext(final String actual, final LdapURL[] expected) { final ActivePassiveConnectionStrategy strategy = new ActivePassiveConnectionStrategy(); strategy.initialize(actual, ldapURL -> true); final Iterator<LdapURL> iter = strategy.iterator(); int i = 0; while (iter.hasNext()) { iter.next(); i++; } Assert.assertEquals(i, expected.length); }
@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();  }