1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.util;
19
20 import junit.framework.TestCase;
21
22
23 /***
24 */
25 public class CounterTest extends TestCase {
26
27 Counter c = new Counter();
28
29
30 public void testCurrentAfterNext() {
31 long next = c.getNext();
32 long current = c.getCurrent();
33 assertEquals(next + 1, current);
34 }
35
36 public void testCurrentBeforeNext() {
37 long current = c.getCurrent();
38 long next = c.getNext();
39 assertEquals(current, next);
40 }
41
42 public void testWrap() {
43 c.setWrap(true);
44 c.setLast(1);
45
46 long a = c.getNext();
47 long b = c.getNext();
48 assertEquals(1, a);
49 assertEquals(1, b);
50 }
51 }