From 8e24819d8638110a4112f6898bd8d2e527a68db2 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Fri, 10 Jun 2011 16:52:15 +0200 Subject: =?UTF-8?q?Mock=20ist=20wieder=20heile=20und=20es=20gibt=20Tests?= =?UTF-8?q?=20f=C3=BCr=20die=20LoginControl...=20und=20eine=20LoginControl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@397 72836036-5685-4462-b002-a69064685172 --- mock/jrummikub/util/MockEvent3.java | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mock/jrummikub/util/MockEvent3.java (limited to 'mock/jrummikub/util') diff --git a/mock/jrummikub/util/MockEvent3.java b/mock/jrummikub/util/MockEvent3.java new file mode 100644 index 0000000..fa1d105 --- /dev/null +++ b/mock/jrummikub/util/MockEvent3.java @@ -0,0 +1,45 @@ +package jrummikub.util; + +import java.util.HashSet; + +/** + * Mock class for Event2s + * + * @param + * first event type + * @param + * second event type + */ +public class MockEvent3 implements IEvent3 { + /** */ + public HashSet> listeners = new HashSet>(); + + @Override + public Connection add(final IListener3 listener) { + listeners.add(listener); + return new Connection() { + + @Override + public void remove() { + MockEvent3.this.remove(listener); + } + }; + } + + @Override + public void remove(IListener3 listener) { + listeners.remove(listener); + } + + /** + * @param value1 + * the first event parameter + * @param value2 + * the second event parameter + */ + public void emit(T1 value1, T2 value2, T3 value3) { + for (IListener3 listener : listeners) { + listener.handle(value1, value2, value3); + } + } +} -- cgit v1.2.3