JVoiceXmlDocumentServer implements DocumentServer { @Override public URI storeAudio(final AudioInputStream in) throws BadFetchError { try { final File directory = getRecordingsDirectory(); final File file = File.createTempFile("rec-", ".wav", directory); AudioSystem.write(in, AudioFileFormat.Type.WAVE, file); LOGGER.info("recorded to file '" + file.toURI() + "'"); return file.toURI(); } catch (IOException ex) { throw new BadFetchError(ex.getMessage(), ex); } } JVoiceXmlDocumentServer(); void setDocumentStorage(final DocumentStorage documentStorage); @Override void start(); void setSchemeStrategies(final List<SchemeStrategy> schemeStrategies); void setFetchAttributes(final FetchAttributes attrs); @Override VoiceXmlDocument getDocument(final String sessionId,
            final DocumentDescriptor descriptor); void addSchemeStrategy(final SchemeStrategy strategy); @Override URI resolveBuiltinUri(final URI uri); @Override URI addGrammarDocument(final String sessionId,
            final GrammarDocument document); @Override GrammarDocument getGrammarDocument(final String sessionId,
            final URI uri, final FetchAttributes attrs); @Override AudioInputStream getAudioInputStream(final String sessionId,
            final URI uri); @Override Object getObject(final String sessionId,
            final DocumentDescriptor descriptor, final String type); @Override URI storeAudio(final AudioInputStream in); @Override void sessionClosed(final String sessionId); @Override void stop();  }
@Test public void testStoreAudio() throws Exception, JVoiceXMLEvent { final URL file = this.getClass().getResource("/test.wav"); final AudioInputStream ain = AudioSystem.getAudioInputStream(file); final URI result = server.storeAudio(ain); Assert.assertNotNull(result); final File rec = new File(result); Assert.assertTrue("expexcted file exists", rec.exists()); }