01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base.events;
06:
07: import com.opensymphony.oscache.base.CacheEntry;
08:
09: 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 254 2005-06-17 05:07:38Z dres $
18: * @version $Revision: 254 $
19: * @author <a href="mailto:abergevin@pyxis-tech.com">Alain Bergevin</a>
20: */
21: public final class TestCacheMapAccessEvent extends TestCase {
22: private final String 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 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(
49: CacheMapAccessEventType.HIT, entry);
50: assertEquals(event.getCacheEntry(), entry);
51: assertEquals(event.getCacheEntryKey(), KEY);
52: assertEquals(event.getEventType(), CacheMapAccessEventType.HIT);
53: }
54: }
|