SiddhiHandler implements RestListener, EventHandler<MapEvent> { public void stop() { log.info("Stopping siddhi plans..."); for (SiddhiPlan siddhiPlan : siddhiPlans.values()) { siddhiPlan.stop(); } } SiddhiHandler(Sink eventReceiver);  SiddhiHandler(); void stop(); Map<String, SiddhiPlan> getSiddhiPlans(); @Override void onEvent(MapEvent mapEvent, long sequence, boolean endOfBatch); @Override void add(Map<String, Object> element); synchronized void add(SiddhiPlan siddhiPlan); @Override synchronized void remove(String id); @Override synchronized void synchronize(List<Map<String, Object>> elements); @Override List<Map<String, Object>> list(); synchronized void save(); synchronized void restore();  }
@Test public void stop() throws ExecutionPlanException { SiddhiPlan siddhiPlanMock = mock(SiddhiPlan.class); when(siddhiPlanMock.getId()).thenReturn("testMockID"); SiddhiPlan siddhiPlanMockTwo = mock(SiddhiPlan.class); when(siddhiPlanMockTwo.getId()).thenReturn("testMockIDTwo"); SiddhiHandler siddhiHandler = new SiddhiHandler(); siddhiHandler.add(siddhiPlanMock); siddhiHandler.add(siddhiPlanMockTwo); siddhiHandler.stop(); verify(siddhiPlanMock).stop(); verify(siddhiPlanMockTwo).stop(); }