1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util;
17
18 import junit.framework.Assert;
19
20 import org.junit.Test;
21
22 public class CounterTest {
23
24 @Test
25 public void testMax() {
26 try {
27 Counter counter = new Counter(Integer.MAX_VALUE);
28 counter.increment();
29 Assert.fail("Should have failed");
30 } catch (IllegalArgumentException e) {
31
32 }
33 }
34
35 @Test
36 public void testMin() {
37 try {
38 Counter counter = new Counter(Integer.MIN_VALUE);
39 counter.decrement();
40 Assert.fail("Should have failed");
41 } catch (IllegalArgumentException e) {
42
43 }
44 }
45
46 @Test
47 public void testMaxLong() {
48 try {
49 LongCounter counter = new LongCounter(Long.MAX_VALUE);
50 counter.increment();
51 Assert.fail("Should have failed");
52 } catch (IllegalArgumentException e) {
53
54 }
55 }
56
57 @Test
58 public void testMinLong() {
59 try {
60 LongCounter counter = new LongCounter(Long.MIN_VALUE);
61 counter.decrement();
62 Assert.fail("Should have failed");
63 } catch (IllegalArgumentException e) {
64
65 }
66 }
67 }