KickJava   Java API By Example, From Geeks To Geeks.

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


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

5 package com.opensymphony.oscache.base.events;
6
7 import junit.framework.Test;
8 import junit.framework.TestCase;
9 import junit.framework.TestSuite;
10
11 import java.util.Date JavaDoc;
12
13 /**
14  * This is the test class for the ScopeEvent class. It checks that the
15  * public methods are working properly
16  *
17  * $Id: TestScopeEvent.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 TestScopeEvent extends TestCase {
22     private final int SCOPE = 3;
23
24     /**
25      * Constructor
26      * <p>
27      * @param str The test name (required by JUnit)
28      */

29     public TestScopeEvent(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 name of this class
37      */

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

45     public void testScopeEvent() {
46         Date JavaDoc date = new Date JavaDoc();
47
48         // Create an object and check the parameters
49
ScopeEvent event = new ScopeEvent(ScopeEventType.ALL_SCOPES_FLUSHED, SCOPE, date, null);
50         assertEquals(event.getEventType(), ScopeEventType.ALL_SCOPES_FLUSHED);
51         assertEquals(event.getScope(), SCOPE);
52         assertTrue(event.getDate().equals(date));
53
54         event = new ScopeEvent(ScopeEventType.SCOPE_FLUSHED, SCOPE, date, null);
55         assertEquals(event.getEventType(), ScopeEventType.SCOPE_FLUSHED);
56         assertEquals(event.getScope(), SCOPE);
57         assertTrue(event.getDate().equals(date));
58     }
59 }
60
Popular Tags