@Test(expected = OWSException.class)
public void testDoCreateStoredQuery_DuplicateId()
                        throws Exception {

    List<FeatureType> featureTypes = featureTypes();
    StoredQueryHandler storedQueryHandler = new StoredQueryHandler( mockWFS( featureTypes ), new ArrayList<URL>(),
                                                                    managedStoredQueries );
    String id = "mangedStoredQuery";
    CreateStoredQuery request = createStoredQuery( id );
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter( outStream );
    try {
        storedQueryHandler.doCreateStoredQuery( request, mockHttpResponseBuffer( xmlStreamWriter ) );
        storedQueryHandler.doCreateStoredQuery( request, mockHttpResponseBuffer( xmlStreamWriter ) );
    } finally {
        xmlStreamWriter.close();
    }
}