public void testUnregisterSubscriber() { bus.register(subscriber); bus.post(new Event1("event1")); bus.unregister(subscriber); subscriber.clearEvents(); bus.post(new Event1("event1")); subscriber.assertNoEvents(); }
public void testSingleSubscriberOneEvent() { Event1 event; bus.register(subscriber); bus.post(event = new Event1("event1")); subscriber.assertSameEvents(event); }
public void testSingleSubscriberManyEvents() { Event1 event; bus.register(subscriber); ArrayList<Object> events = new ArrayList<Object>(); for (int i = 0; i < 10; i++) { bus.post(event = new Event1("event1")); events.add(event); } subscriber.assertSameEventsList(events); }
public void testPostEventWithProducer() { // System.out.println("Current: " + Thread.currentThread()); // System.out.println("Looper: " + Looper.getMainLooper().getThread()); bus.register(producer); bus.register(subscriber); ArrayList<Object> events = new ArrayList<Object>(); events.add(producer.lastEvent); Event1 event; bus.post(event = new Event1("second")); events.add(event); subscriber.assertSameEventsList(events); }
public void testProducerFirstWithNullEvent() { producer.lastEvent = null; bus.register(producer); bus.register(subscriber); subscriber.assertNoEvents(); }
public void testUnregisterProducer() { bus.register(producer); bus.unregister(producer); bus.register(subscriber); subscriber.assertNoEvents(); }
public void testProducerFirst() { bus.register(producer); bus.register(subscriber); subscriber.assertSameEvents(producer.lastEvent); }