01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.util;
06:
07: import junit.framework.TestCase;
08:
09: /**
10: * User: plightbo
11: * Date: Jan 7, 2004
12: * Time: 7:55:35 PM
13: */
14: public class CounterTest extends TestCase {
15:
16: Counter c = new Counter();
17:
18: public void testCurrentAfterNext() {
19: long next = c.getNext();
20: long current = c.getCurrent();
21: assertEquals(next + 1, current);
22: }
23:
24: public void testCurrentBeforeNext() {
25: long current = c.getCurrent();
26: long next = c.getNext();
27: assertEquals(current, next);
28: }
29:
30: public void testWrap() {
31: c.setWrap(true);
32: c.setLast(1);
33:
34: long a = c.getNext();
35: long b = c.getNext();
36: assertEquals(1, a);
37: assertEquals(1, b);
38: }
39: }
|