KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > naming > directory > MockNamingEnumeration


1 package com.mockobjects.naming.directory;
2
3 import com.mockobjects.*;
4 import javax.naming.*;
5 import javax.naming.directory.*;
6 import java.util.*;
7
8 public class MockNamingEnumeration extends MockObject
9 implements NamingEnumeration{
10     private List mySearchResults = new ArrayList();
11
12     private boolean hasMore = true;
13
14     public void setupAddSearchResult(Object JavaDoc object){
15         mySearchResults.add(object);
16     }
17
18     public Object JavaDoc next() throws NamingException{
19         return mySearchResults.remove(0);
20     }
21
22     public boolean hasMore() throws NamingException{
23         return mySearchResults.size()>0;
24     }
25
26     public void close() throws NamingException{
27     }
28
29     public boolean hasMoreElements(){
30         return mySearchResults.size()>0;
31     }
32
33     public Object JavaDoc nextElement(){
34         return mySearchResults.remove(0);
35     }
36 }
37
Popular Tags