KickJava   Java API By Example, From Geeks To Geeks.

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


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.CacheEntry;
8
9 import junit.framework.Test;
10 import junit.framework.TestCase;
11 import junit.framework.TestSuite;
12
13 /**
14  * This is the test class for the CacheMapAccessEvent class. It checks that the
15  * public methods are working properly
16  *
17  * $Id: TestCacheMapAccessEvent.java,v 1.1 2005/06/17 05:07:00 dres Exp $
18  * @version $Revision: 1.1 $
19  * @author <a HREF="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
20  */

21 public final class TestCacheMapAccessEvent extends TestCase {
22     private final String JavaDoc KEY = "Test cache map access event key";
23
24     /**
25      * Constructor
26      * <p>
27      * @param str The test name (required by JUnit)
28      */

29     public TestCacheMapAccessEvent(String JavaDoc str) {
30         super(str);
31     }
32
33     /**
34      * This methods returns the name of this test class to JUnit
35      * <p>
36      * @return The test for this class
37      */

38     public static Test suite() {
39         return new TestSuite(TestCacheMapAccessEvent.class);
40     }
41
42     /**
43      * Test the CacheMapAccessEvent class
44      */

45     public void testCacheMapAccessEvent() {
46         // Create an object and check the parameters
47
CacheEntry entry = new CacheEntry(KEY);
48         CacheMapAccessEvent event = new CacheMapAccessEvent(CacheMapAccessEventType.HIT, entry);
49         assertEquals(event.getCacheEntry(), entry);
50         assertEquals(event.getCacheEntryKey(), KEY);
51         assertEquals(event.getEventType(), CacheMapAccessEventType.HIT);
52     }
53 }
54
Popular Tags