DefaultNamingEnumeration implements NamingEnumeration<NameClassPair> { @Override public NameClassPair nextElement() { return nameClassPairs.nextElement(); } DefaultNamingEnumeration(Collection<NameClassPair> nameClassPairs); @Override void close(); @Override boolean hasMore(); @Override boolean hasMoreElements(); @Override NameClassPair next(); @Override NameClassPair nextElement();  }
@Test public void testNextElement() throws Exception { DefaultNamingEnumeration enumeration = new DefaultNamingEnumeration(new ArrayList<>()); assertThrows(NoSuchElementException.class, enumeration::nextElement); }