EsperTemplate implements EsperTemplateOperations { public synchronized void addStatement(EsperStatement statement) { statements.add(statement); if (this.initialised) { EPStatement epStatement = epServiceProvider.getEPAdministrator().createEPL(statement.getEPL()); statement.setEPStatement(epStatement); } }  void setName(String name); String getName(); void setStatements(Set<EsperStatement> statements); void setConfiguration(Resource configuration); void setUnmatchedListener(UnmatchedListener unmatchedListener); EPRuntime getEsperNativeRuntime(); Set<EsperStatement> getStatements(); synchronized void addStatement(EsperStatement statement); synchronized void destroyStatement(String statementId); synchronized void startStatement(String statementId); synchronized void stopStatement(String statementId); void sendEvent(Object event); synchronized void initialize(); void cleanup();  }
@Test public void testEventWithOneStatementNoListener() { EsperStatement statement = addTestStatement(); template.addStatement(statement); setupTemplateAndSendSampleEvent(); }
@Test public void testEventWithOneStatementWithOneListener() { EsperStatement statement = addTestStatement(); CallRecordingListener listener = this.addListenerToStatement(statement); template.addStatement(statement); setupTemplateAndSendSampleEvent(); assertEquals(1, listener.getNumberOfTimesInvoked()); }