8176474: test/jdk/jshell/JdiBogusHostListenExecutionControlTest.java fails with java.net.BindException
authorrfield
Thu, 22 Feb 2018 12:26:01 -0800
changeset 48934 3390b463d7a2
parent 48933 20358c9f72c1
child 48935 03ae177c26b0
8176474: test/jdk/jshell/JdiBogusHostListenExecutionControlTest.java fails with java.net.BindException Reviewed-by: jlahoda
test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java
--- a/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java	Thu Feb 22 18:53:28 2018 +0100
+++ b/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java	Thu Feb 22 12:26:01 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8169519 8168615
+ * @bug 8169519 8168615 8176474
  * @summary Tests for JDI connector failure
  * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution
  * @run testng JdiBogusHostListenExecutionControlTest
@@ -40,7 +40,9 @@
 public class JdiBogusHostListenExecutionControlTest {
 
     private static final String EXPECTED_ERROR =
-            "Launching JShell execution engine threw: Failed remote listen: java.net.SocketException: Unresolved address @ com.sun.jdi.SocketListe";
+            "Launching JShell execution engine threw: Failed remote listen:";
+    private static final String EXPECTED_LOCATION =
+            "@ com.sun.jdi.SocketListen";
 
     public void badOptionListenTest() {
         try {
@@ -50,7 +52,10 @@
                     .executionEngine("jdi:hostname(BattyRumbleBuckets-Snurfle-99-Blip)")
                     .build();
         } catch (IllegalStateException ex) {
-            assertTrue(ex.getMessage().startsWith(EXPECTED_ERROR), ex.getMessage());
+            assertTrue(ex.getMessage().startsWith(EXPECTED_ERROR),
+                    ex.getMessage() + "\nExpected: " + EXPECTED_ERROR);
+            assertTrue(ex.getMessage().contains(EXPECTED_LOCATION),
+                    ex.getMessage() + "\nExpected: " + EXPECTED_LOCATION);
             return;
         }
         fail("Expected IllegalStateException");