Jsapi20SynthesizedOutput implements SynthesizedOutput, SpeakableListener, SynthesizerListener,
        AudioSource { @Override public void waitQueueEmpty() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("waiting for empty queue..."); } while (!queuedSpeakables.isEmpty()) { synchronized (emptyLock) { try { emptyLock.wait(WAIT_EMPTY_TIMEINTERVALL); } catch (InterruptedException e) { return; } } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("...queue emptied"); } } Jsapi20SynthesizedOutput(final SynthesizerMode defaultDescriptor,
            final OutputMediaLocatorFactory mediaLocatorFactory); void setMediaLocator(final URI locator); @Override void open(); @Override void close(); @Override void addListener(final SynthesizedOutputListener outputListener); @Override void removeListener(final SynthesizedOutputListener outputListener); @Override void queueSpeakable(final SpeakableText speakable,
            final String sessId, final DocumentServer documentServer); @Override boolean supportsBargeIn(); @Override void cancelOutput(final BargeInType bargeInType); @Override void waitNonBargeInPlayed(); @Override void waitQueueEmpty(); void reachedMark(final String mark); @Override void activate(); @Override AudioFormat getAudioFormat(); @Override void setOutputStream(final OutputStream out); @Override void passivate(); @Override void connect(final ConnectionInformation info); @Override void disconnect(final ConnectionInformation info); @Override String getType(); void setType(final String resourceType); @Override boolean isBusy(); @Override void speakableUpdate(final SpeakableEvent event); @Override void synthesizerUpdate(final SynthesizerEvent event);  }
@Test public void testWaitQueueEmpty() throws JVoiceXMLEvent, Exception { final SsmlDocument ssml = new SsmlDocument(); final Speak speak = ssml.getSpeak(); speak.addText("this is a test"); final SpeakableText speakable1 = new SpeakableSsmlText(ssml); output.queueSpeakable(speakable1, sessionId, documentServer); output.waitQueueEmpty(); Assert.assertFalse("output should be busy", output.isBusy()); }