1 22 package org.objectweb.petals.kernel.registry.jndi; 23 24 import javax.naming.NameClassPair ; 25 import javax.naming.NamingException ; 26 27 import junit.framework.TestCase; 28 29 34 public class NamingEnumerationImplTest extends TestCase { 35 36 public void testClose() throws NamingException { 37 NamingEnumerationImpl<NameClassPair > names = new NamingEnumerationImpl<NameClassPair >( 38 new NameClassPair [0]); 39 names.close(); 40 assertNull(names.iterator); 41 } 42 43 public void testHasMore() throws NamingException { 44 NamingEnumerationImpl<NameClassPair > names = new NamingEnumerationImpl<NameClassPair >( 45 new NameClassPair [0]); 46 assertFalse(names.hasMore()); 47 names = new NamingEnumerationImpl<NameClassPair >(new NameClassPair [1]); 48 assertTrue(names.hasMore()); 49 } 50 51 public void testHasMoreElements() throws NamingException { 52 NamingEnumerationImpl<NameClassPair > names = new NamingEnumerationImpl<NameClassPair >( 53 new NameClassPair [0]); 54 assertFalse(names.hasMoreElements()); 55 names = new NamingEnumerationImpl<NameClassPair >(new NameClassPair [1]); 56 assertTrue(names.hasMoreElements()); 57 } 58 59 public void testNext() throws NamingException { 60 NamingEnumerationImpl<String > names = new NamingEnumerationImpl<String >( 61 new String [] {"test"}); 62 assertEquals(names.next(), "test"); 63 } 64 65 public void testNextElement() throws NamingException { 66 NamingEnumerationImpl<String > names = new NamingEnumerationImpl<String >( 67 new String [] {"test"}); 68 assertEquals(names.nextElement(), "test"); 69 } 70 } 71 | Popular Tags |