public void testAddUnlistenListener_Unlisten_2() {
mockInit();
//caused by add UnlistenListener
mockRegister(DomainFactory.UNLISTEN_DOMAIN);
final UnlistenEventListenerTestMode theUnlistenEventListener = new UnlistenEventListenerTestMode();
final UnlistenEvent theUnlistenEvent = new DefaultUnlistenEvent(new HashSet<Domain>(Arrays.asList(TEST_DOMAIN)), "testUser", false);
mockRegisterUnlistenEvent(theUnlistenEvent);
//mock listen
List<DomainEvent> theDomainEvents = new ArrayList<DomainEvent>();
theDomainEvents.add(new DefaultDomainEvent(theUnlistenEvent, DomainFactory.UNLISTEN_DOMAIN));
mockListen(theDomainEvents, 1);
//add UnlistenListener
assertEquals(0, theUnlistenEventListener.getEventCount());
assertFalse(myRemoteEventService.isActive());
myRemoteEventService.addUnlistenListener(UnlistenEventListener.Scope.UNLISTEN, theUnlistenEventListener, theUnlistenEvent, null);
assertTrue(myRemoteEventService.isActive());
assertEquals(1, theUnlistenEventListener.getEventCount());
assertEquals(1, theUnlistenEventListener.getEventCount(DefaultUnlistenEvent.class));
final UnlistenEvent theUnlistenEventResult = (UnlistenEvent)theUnlistenEventListener.getEvents().get(0);
assertFalse(theUnlistenEventResult.isTimeout());
assertFalse(theUnlistenEventResult.isLocal());
assertEquals(1, theUnlistenEventResult.getDomains().size());
assertEquals(TEST_DOMAIN, theUnlistenEventResult.getDomains().iterator().next());
assertEquals("testUser", theUnlistenEventResult.getUserId());