summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/jrummikub/util/MockEvent.java22
-rw-r--r--test/jrummikub/util/MockEvent1.java6
-rw-r--r--test/jrummikub/util/MockEvent2.java6
3 files changed, 26 insertions, 8 deletions
diff --git a/test/jrummikub/util/MockEvent.java b/test/jrummikub/util/MockEvent.java
index 85f2c28..2f0efe5 100644
--- a/test/jrummikub/util/MockEvent.java
+++ b/test/jrummikub/util/MockEvent.java
@@ -4,14 +4,20 @@ import java.util.HashSet;
public class MockEvent implements IEvent {
public HashSet<IListener> listeners = new HashSet<IListener>();
-
+
+ @Override
+ public void add(IListener listener) {
+ listeners.add(listener);
+ }
+
@Override
- public void add(IListener listener) {
- listeners.add(listener);
- }
+ public void remove(IListener listener) {
+ listeners.remove(listener);
+ }
- @Override
- public void remove(IListener listener) {
- listeners.remove(listener);
- }
+ public void emit() {
+ for (IListener listener : listeners) {
+ listener.handle();
+ }
+ }
}
diff --git a/test/jrummikub/util/MockEvent1.java b/test/jrummikub/util/MockEvent1.java
index 36af527..74cae0f 100644
--- a/test/jrummikub/util/MockEvent1.java
+++ b/test/jrummikub/util/MockEvent1.java
@@ -14,4 +14,10 @@ public class MockEvent1<T> implements IEvent1<T> {
public void remove(IListener1<T> listener) {
listeners.remove(listener);
}
+
+ public void emit(T value) {
+ for (IListener1<T> listener : listeners) {
+ listener.handle(value);
+ }
+ }
}
diff --git a/test/jrummikub/util/MockEvent2.java b/test/jrummikub/util/MockEvent2.java
index 4f01372..93e8228 100644
--- a/test/jrummikub/util/MockEvent2.java
+++ b/test/jrummikub/util/MockEvent2.java
@@ -14,4 +14,10 @@ public class MockEvent2<T1, T2> implements IEvent2<T1, T2> {
public void remove(IListener2<T1, T2> listener) {
listeners.remove(listener);
}
+
+ public void emit(T1 value1, T2 value2) {
+ for (IListener2<T1, T2> listener : listeners) {
+ listener.handle(value1, value2);
+ }
+ }
}