01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.base.events;
06:
07: import java.util.Date;
08:
09: 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 CachewideEvent class. It checks that the
17: * public methods are working properly
18: *
19: * $Id: TestCacheEntryEvent.java 385 2006-10-07 06:57:10Z larst $
20: * @version $Revision: 385 $
21: * @author Lars Torunski
22: */
23: public final class TestCachewideEvent extends TestCase {
24:
25: /**
26: * Constructor
27: * <p>
28: * @param str The test name (required by JUnit)
29: */
30: public TestCachewideEvent(String str) {
31: super (str);
32: }
33:
34: /**
35: * This methods returns the name of this test class to JUnit
36: * <p>
37: * @return The test for this class
38: */
39: public static Test suite() {
40: return new TestSuite(TestCachewideEvent.class);
41: }
42:
43: /**
44: * Test the CacheEntryEvent class
45: */
46: public void testCacheEntryEvent() {
47: // Create all the required objects
48: GeneralCacheAdministrator admin = new GeneralCacheAdministrator();
49:
50: Date date = new Date();
51: CachewideEvent event = new CachewideEvent(admin.getCache(),
52: date, null);
53:
54: // Get back the values and assert them
55: assertEquals(event.getDate(), date);
56: assertEquals(event.getCache(), admin.getCache());
57: }
58: }
|