1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.binding.value.support;
17
18 import javax.swing.event.ListDataEvent;
19
20 import org.easymock.IArgumentMatcher;
21
22
23
24
25
26
27 public class ListDataEventArgumentMatcher implements IArgumentMatcher {
28
29 private ListDataEvent expected;
30
31 public ListDataEventArgumentMatcher(ListDataEvent expected) {
32 this.expected = expected;
33 }
34
35 public void appendTo(StringBuffer sb) {
36 sb.append("javax.swing.event.ListDataEvent[");
37
38 sb.append("type=").append(expected.getType()).append(", ");
39 sb.append("index0=").append(expected.getIndex0()).append(", ");
40 sb.append("index1=").append(expected.getIndex1()).append(", ");
41
42 sb.append("]");
43 }
44
45 public boolean matches(Object value) {
46 if (!(value instanceof ListDataEvent)) {
47 return false;
48 }
49
50 ListDataEvent actual = (ListDataEvent) value;
51
52 boolean matches = true;
53 matches = matches && actual.getSource().equals(expected.getSource());
54 matches = matches && actual.getType() == expected.getType();
55 matches = matches && actual.getIndex0() == expected.getIndex0();
56 matches = matches && actual.getIndex1() == expected.getIndex1();
57
58 return matches;
59 }
60
61 }