View Javadoc
1   /**
2    * 
3    */
4   package org.melati.poem.util.test;
5   
6   import org.melati.poem.util.CachedIndexFactory;
7   
8   import junit.framework.TestCase;
9   
10  /**
11   * @author timp
12   * @since 7 Jun 2007
13   *
14   */
15  public class CachedIndexFactoryTest extends TestCase {
16    CachedIndexFactory it; 
17    
18    /**
19     * @param name
20     */
21    public CachedIndexFactoryTest(String name) {
22      super(name);
23    }
24  
25    /** 
26     * {@inheritDoc}
27     * @see junit.framework.TestCase#setUp()
28     */
29    protected void setUp() throws Exception {
30      super.setUp();
31      it = new CachedIndexFactory() { 
32        public Object reallyGet(int index) {
33          if ((index / 2)*2 == index)
34            return new Integer(index);
35          else
36            return null;
37        }   
38      };
39    }
40  
41    /** 
42     * {@inheritDoc}
43     * @see junit.framework.TestCase#tearDown()
44     */
45    protected void tearDown() throws Exception {
46      super.tearDown();
47    }
48  
49    /**
50     * Test method for {@link org.melati.poem.util.CachedIndexFactory#reallyGet(int)}.
51     */
52    public void testReallyGet() {
53      
54    }
55  
56    /**
57     * Test method for {@link org.melati.poem.util.CachedIndexFactory#get(int)}.
58     */
59    public void testGet() {
60      assertNull(it.get(3)); // Really get it - it is null
61      assertNull(it.get(3)); // Get it from cache - it is null
62      it.invalidate(3);
63      assertNull(it.get(3)); // Really get it - it is null    
64    }
65  
66    /**
67     * Test method for {@link org.melati.poem.util.CachedIndexFactory#invalidate(int)}.
68     */
69    public void testInvalidateInt() {
70      
71    }
72  
73    /**
74     * Test method for {@link org.melati.poem.util.CachedIndexFactory#invalidate()}.
75     */
76    public void testInvalidate() {
77      
78    }
79  
80  }