package com.yahoo.document.restapi;

import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import org.junit.Test;

/**
 * @author bratseth
 */
public class DocumentApiApplicationTest {

    /** Test that it is possible to instantiate an Application with a document-api */
    @Test
    public void application_with_document_api() {
        String services =
                "<container version='1.0'>" +
                "    <document-api/>" +
                "</container>";
        try (Application application = Application.fromServicesXml(services, Networking.enable)) {
        }
    }

}

@@ -137,16 +137,75 @@
 .Test;%0A%0A
+import java.io.IOException;%0Aimport java.net.ServerSocket;%0A%0A
 /**%0A * @
@@ -410,16 +410,35 @@
 nt_api()
+ throws IOException
  %7B%0A     
@@ -476,25 +476,21 @@
       %22%3C
-container
+jdisc
  version
@@ -496,24 +496,143 @@
 n='1.0'%3E%22 +%0A
+                %22    %3Chttp%3E%3Cserver port=%5C%22%22 + findRandomOpenPortOnAllLocalInterfaces() + %22%5C%22 id=%5C%22foobar%5C%22/%3E%3C/http%3E%22 +%0A
             
@@ -682,17 +682,13 @@
  %22%3C/
-container
+jdisc
 %3E%22;%0A
@@ -803,10 +803,148 @@
 %0A    %7D%0A%0A
+    private int findRandomOpenPortOnAllLocalInterfaces() throws IOException %7B%0A           return new ServerSocket(0).getLocalPort();%0A    %7D%0A
 %7D%0A

Make test not require port 4080 to be available.