Add test for init twice. (#62)

diff --git a/java8/proxy/src/main/java/openwhisk/java/action/Proxy.java b/java8/proxy/src/main/java/openwhisk/java/action/Proxy.java
index 6233e92..fd80333 100644
--- a/java8/proxy/src/main/java/openwhisk/java/action/Proxy.java
+++ b/java8/proxy/src/main/java/openwhisk/java/action/Proxy.java
@@ -85,10 +85,8 @@
                 String base64Jar = message.getAsJsonPrimitive("code").getAsString();
 
                 // FIXME: this is obviously not very useful. The idea is that we
-                // will implement/use
-                // a streaming parser for the incoming JSON object so that we
-                // can stream the contents
-                // of the jar straight to a file.
+                // will implement/use a streaming parser for the incoming JSON object so that we
+                // can stream the contents of the jar straight to a file.
                 InputStream jarIs = new ByteArrayInputStream(base64Jar.getBytes(StandardCharsets.UTF_8));
 
                 // Save the bytes to a file.
diff --git a/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala b/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala
index f30ccd1..a3094a8 100644
--- a/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala
+++ b/tests/src/test/scala/actionContainers/JavaActionContainerTests.scala
@@ -124,6 +124,34 @@
     err.trim shouldBe empty
   }
 
+  it should "not allow initialization twice" in {
+    val (out, err) = withJavaContainer { c =>
+      val jar = JarBuilder.mkBase64Jar(
+        Seq("example", "HelloWhisk.java") ->
+          """
+            | package example;
+            |
+            | import com.google.gson.JsonObject;
+            |
+            | public class HelloWhisk {
+            |     public static JsonObject main(JsonObject args) {
+            |         return args;
+            |     }
+            | }
+          """.stripMargin.trim)
+
+      val (initCode, _) = c.init(initPayload("example.HelloWhisk", jar))
+      initCode should be(200)
+
+      val (initCode2, out2) = c.init(initPayload("example.HelloWhisk", jar))
+      initCode2 should (be < 200 or be > 299) // the code does not matter, just cannot be 20x
+      out2 should be(Some(JsObject("error" -> JsString("Cannot initialize the action more than once."))))
+    }
+
+    out.trim shouldBe empty
+    err.trim shouldBe empty
+  }
+
   it should "support valid actions with non 'main' names" in {
     val (out, err) = withJavaContainer { c =>
       val jar = JarBuilder.mkBase64Jar(