diff options
Diffstat (limited to 'test/jrummikub/util/MockEvent.java')
-rw-r--r-- | test/jrummikub/util/MockEvent.java | 22 |
1 files changed, 14 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(); + } + } } |