1 23 24 package com.rift.coad.lib.naming.cos; 25 26 import junit.framework.*; 27 import java.util.Enumeration ; 28 import javax.naming.NamingEnumeration ; 29 30 34 public class MemoryNamingEnumerationTest extends TestCase { 35 36 public MemoryNamingEnumerationTest(String testName) { 37 super(testName); 38 } 39 40 protected void setUp() throws Exception { 41 } 42 43 protected void tearDown() throws Exception { 44 } 45 46 public static Test suite() { 47 TestSuite suite = new TestSuite(MemoryNamingEnumerationTest.class); 48 49 return suite; 50 } 51 52 55 public void testMemoryNamingEnumeration() throws Exception { 56 System.out.println("MemoryNamingEnumeration"); 57 58 MemoryNamingEnumeration instance = new MemoryNamingEnumeration( 59 new NamingParser().parse("java:comp/test/freddy/bob").getAll()); 60 61 int index = 0; 62 while (instance.hasMore()) { 63 Object result = instance.next(); 64 if ((index == 0) && (!result.equals("java:comp"))) { 65 fail("java:comp not found."); 66 } else if ((index == 1) && (!result.equals("test"))) { 67 fail("test not found."); 68 } else if ((index == 2) && (!result.equals("freddy"))) { 69 fail("freddy not found."); 70 } else if ((index == 3) && (!result.equals("bob"))) { 71 fail("bob not found."); 72 } 73 index++; 74 } 75 76 } 77 78 79 } 80 | Popular Tags |