@Test
public void writeServiceDocument() throws Exception {

  CsdlEdmProvider provider = new MetadataDocumentXmlSerializerTest.LocalProvider();
  ServiceMetadata serviceMetadata = new ServiceMetadataImpl(provider,
      Collections.<EdmxReference> emptyList(), null);
  InputStream metadataStream = serializer.serviceDocument(serviceMetadata, "http://host/svc").getContent();
  String metadata = IOUtils.toString(metadataStream);
  assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
      + "<app:service xmlns:atom=\"http://www.w3.org/2005/Atom\" "
      + "xmlns:app=\"http://www.w3.org/2007/app\" "
      + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
      + "metadata:context=\"http://host/svc/$metadata\">"
      + "<app:workspace>"
      + "<atom:title>org.olingo.container</atom:title>"
      + "<app:collection href=\"ESAllPrim\" metadata:name=\"ESAllPrim\">"
      + "<atom:title>ESAllPrim</atom:title>"
      + "</app:collection>"
      + "<metadata:function-import href=\"FINRTInt16\" metadata:name=\"FINRTInt16\">"
      + "<atom:title>FINRTInt16</atom:title>"
      + "</metadata:function-import>"
      + "<metadata:function-import href=\"FINRTET\" metadata:name=\"FINRTET\">"
      + "<atom:title>FINRTET</atom:title>"
      + "</metadata:function-import>"
      + "<metadata:singleton href=\"SI\" metadata:name=\"SI\">"
      + "<atom:title>SI</atom:title>"
      + "</metadata:singleton>"
      + "</app:workspace>"
      + "</app:service>",
      metadata);
}