DocumentStorage { public void clear(final String sessionId) throws URISyntaxException { final Collection<GrammarDocument> currentDocuments = sessionDocuments .get(sessionId); if (currentDocuments == null) { LOGGER.warn("session '" + sessionId + "' unknown. cannot clear"); return; } for (GrammarDocument document : currentDocuments) { final URI uri = document.getURI(); final String path = uri.getPath(); final URI pathUri = new URI(path); documents.remove(pathUri); } sessionDocuments.remove(sessionId); LOGGER.info("cleared document storage for session '" + sessionId + "'"); } DocumentStorage(); void setStoragePort(final int port); void setGrammarCreators(final Collection<GrammarCreator> col); void start(); URI resolveBuiltinUri(final URI uri); URI addGrammarDocument(final String sessionId,
            final GrammarDocument document); GrammarDocument getDocument(final URI uri); void clear(final String sessionId); void stop();  }
@Test public void testClear() throws Exception { final GrammarDocument document = new ExternalGrammarDocument(null, null, null, true); storage.addGrammarDocument("12345", document); final URI uri = document.getURI(); Assert.assertNotNull(uri); Assert.assertEquals(document, storage.getDocument(uri)); storage.clear("12345"); Assert.assertNull("document not cleared", storage.getDocument(uri)); }