content: package io.alkal.kalium.tests;/*
   * This Java source file was generated by the Gradle 'init' task.
   */
  import io.alkal.kalium.Kalium;
  import io.alkal.kalium.exceptions.KaliumBuilderException;
  import io.alkal.kalium.tests.utils.DummyKaliumQueueAdapter;
  import io.alkal.kalium.tests.utils.DummyQueue;
  import org.junit.Test;
  import org.mockito.Mockito;
  
  /**
   * @author Ziv Salzman
   * Created on 20-Jan-2019
   */
  public class KaliumBasicTest {
  
      @Test
      public void testItShouldCallReactionMethod_whenAMatchingEventIsPosted() throws KaliumBuilderException {
  
          DummyQueue dummyQueue = new DummyQueue();
  
          DummyKaliumQueueAdapter queueAdapter1 = new DummyKaliumQueueAdapter();
          queueAdapter1.setDummyQueue(dummyQueue);
          MyReaction myReaction = Mockito.spy(new MyReaction());
          Kalium kalium1 = Kalium.Builder()
                  .setQueueAdapter(queueAdapter1)
                  .build();
  
          kalium1.addReaction(myReaction);
          kalium1.start();
  
          DummyKaliumQueueAdapter queueAdapter2 = new DummyKaliumQueueAdapter();
          queueAdapter2.setDummyQueue(dummyQueue);
  
          Kalium kalium2 = Kalium.Builder()
                  .setQueueAdapter(queueAdapter2)
                  .build();
          Mockito.spy(kalium2);
          kalium2.start();
  
          Payment payment = new Payment();
  
          kalium2.post(payment);
  
          Mockito.verify(myReaction).doSomething(Mockito.eq(payment));
  
      }
  
  
  }
  