Added tests for Connection

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@150 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Jannis Harder 2011-05-05 19:49:59 +02:00
parent 44ee94041a
commit 53824198db
10 changed files with 93 additions and 6 deletions

View file

@ -80,4 +80,29 @@ public class Event1Test {
testEvent.emit(10);
assertEquals(fired, 10);
}
@Test
public void removeListenerByConnection() {
fired = 0;
Event1<Integer> testEvent = new Event1<Integer>();
testEvent.add(new IListener1<Integer>() {
@Override
public void handle(Integer n) {
fired += n;
}
});
IListener1<Integer> rem = new IListener1<Integer>() {
@Override
public void handle(Integer n) {
fail();
}
};
Connection connection = testEvent.add(rem);
connection.remove();
testEvent.emit(10);
assertEquals(fired, 10);
}
}