KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > oscache > base > events > TestCacheEntryEvent


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.oscache.base.events;
6
7 import com.opensymphony.oscache.base.Cache;
8 import com.opensymphony.oscache.base.CacheEntry;
9 import com.opensymphony.oscache.general.GeneralCacheAdministrator;
10
11 import junit.framework.Test;
12 import junit.framework.TestCase;
13 import junit.framework.TestSuite;
14
15 /**
16  * This is the test class for the CacheEntryEvent class. It checks that the
17  * public methods are working properly
18  *
19  * $Id: TestCacheEntryEvent.java,v 1.1 2005/06/17 05:07:00 dres Exp $
20  * @version $Revision: 1.1 $
21  * @author <a HREF="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
22  */

23 public final class TestCacheEntryEvent extends TestCase {
24     /**
25      * Constants required for the test
26      */

27     private final String JavaDoc KEY = "Test cache entry event key";
28     private final int SCOPE = 3;
29
30     /**
31      * Constructor
32      * <p>
33      * @param str The test name (required by JUnit)
34      */

35     public TestCacheEntryEvent(String JavaDoc str) {
36         super(str);
37     }
38
39     /**
40      * This methods returns the name of this test class to JUnit
41      * <p>
42      * @return The test for this class
43      */

44     public static Test suite() {
45         return new TestSuite(TestCacheEntryEvent.class);
46     }
47
48     /**
49      * Test the CacheEntryEvent class
50      */

51     public void testCacheEntryEvent() {
52         // Create all the required objects
53
GeneralCacheAdministrator admin = new GeneralCacheAdministrator();
54         Cache map = new Cache(admin.isMemoryCaching(), admin.isUnlimitedDiskCache(), admin.isOverflowPersistence());
55         CacheEntry entry = new CacheEntry(KEY);
56         CacheEntryEvent event = new CacheEntryEvent(map, entry, null);
57
58         // Get back the values and assert them
59
assertEquals(event.getEntry(), entry);
60         assertEquals(event.getKey(), KEY);
61         assertEquals(event.getMap(), map);
62     }
63 }
64
Popular Tags