EventProcessor { synchronized void update(E event) { Next<M, F> next = store.update(event); next.ifHasModel( new Consumer<M>() { @Override public void accept(M model) { dispatchModel(model); } }); dispatchEffects(next.effects()); } EventProcessor(
      MobiusStore<M, E, F> store, Consumer<F> effectConsumer, Consumer<M> modelConsumer);   }
@Test public void shouldEmitStateIfStateChanged() throws Exception { underTest.update(1); stateConsumer.assertValues("init!->1"); }
@Test public void shouldNotEmitStateIfStateNotChanged() throws Exception { stateConsumer.clearValues(); underTest.update(0); stateConsumer.assertValues(); }
@Test public void shouldOnlyEmitStateStateChanged() throws Exception { underTest.update(0); underTest.update(1); underTest.update(0); underTest.update(2); stateConsumer.assertValues("init!->1", "init!->1->2"); }
@Test public void shouldEmitEffectsWhenStateChanges() throws Exception { effectConsumer.clearValues(); underTest.update(3); effectConsumer.assertValuesInAnyOrder(10L, 20L, 30L); }