Commit 13d2422f authored by Phillip Webb's avatar Phillip Webb

Merge pull request #5 from gregturn/BS-162

# By Greg Turnquist
* BS-162:
  Tune expected exceptions to support more platforms
parents 19c2a076 9ab2f98d
......@@ -16,7 +16,7 @@
package org.springframework.bootstrap.actuate.autoconfigure;
import java.io.FileNotFoundException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.URI;
import java.nio.charset.Charset;
......@@ -49,6 +49,7 @@ import static org.junit.Assert.assertThat;
* Tests for {@link EndpointWebMvcAutoConfiguration}.
*
* @author Phillip Webb
* @author Greg Turnquist
*/
public class EndpointWebMvcAutoConfigurationTests {
......@@ -170,7 +171,7 @@ public class EndpointWebMvcAutoConfigurationTests {
}
} catch (Exception ex) {
if (expected == null) {
if (ConnectException.class.isInstance(ex)
if (SocketException.class.isInstance(ex)
|| FileNotFoundException.class.isInstance(ex)) {
return;
}
......
......@@ -18,7 +18,7 @@ package org.springframework.bootstrap.context.embedded;
import java.io.FileWriter;
import java.io.IOException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
......@@ -56,6 +56,7 @@ import static org.mockito.Mockito.mock;
* Base for testing classes that extends {@link AbstractEmbeddedServletContainerFactory}.
*
* @author Phillip Webb
* @author Greg Turnquist
*/
public abstract class AbstractEmbeddedServletContainerFactoryTests {
......@@ -91,8 +92,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
factory.setPort(0);
this.container = factory
.getEmbeddedServletContainer(exampleServletRegistration());
this.thrown.expect(ConnectException.class);
this.thrown.expectMessage("Connection refused");
this.thrown.expect(SocketException.class);
getResponse("http://localhost:8080/hello");
}
......@@ -102,7 +102,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
this.container = factory
.getEmbeddedServletContainer(exampleServletRegistration());
this.container.stop();
this.thrown.expect(ConnectException.class);
this.thrown.expect(SocketException.class);
getResponse("http://localhost:8080/hello");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment