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