From 53824198db2bade71c895c91caab14f338139fd2 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Thu, 5 May 2011 19:49:59 +0200 Subject: Added tests for Connection git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@150 72836036-5685-4462-b002-a69064685172 --- test/jrummikub/util/EventTest.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/jrummikub/util/EventTest.java') diff --git a/test/jrummikub/util/EventTest.java b/test/jrummikub/util/EventTest.java index 15bd632..f8c505c 100644 --- a/test/jrummikub/util/EventTest.java +++ b/test/jrummikub/util/EventTest.java @@ -79,5 +79,30 @@ public class EventTest { testEvent.emit(); assertTrue(fired); } + + @Test + public void removeListenerByConnection() { + fired = false; + Event testEvent = new Event(); + testEvent.add(new IListener() { + + @Override + public void handle() { + fired = true; + + } + }); + IListener rem = new IListener() { + + @Override + public void handle() { + fail(); + } + }; + Connection connection = testEvent.add(rem); + connection.remove(); + testEvent.emit(); + assertTrue(fired); + } } -- cgit v1.2.3