Commit f2d8ca8b authored by Madhura Bhave's avatar Madhura Bhave

Fix failing NettyReactiveWebServerFactoryTests

NettyReactiveWebServerFactoryTests.portInUseExceptionIsThrownWhenPortIsAlreadyInUse
started failing on CI following this change in reactor netty:
https://github.com/reactor/reactor-netty/commit/e6634c27f6e847b7a6998a1f642c0b7efdf0c610
Instead of a `BindException`, a `NativeIoException` is thrown. Since that Exception
is for internal use only, we throw a generic `WebServerException`
instead of the `PortInUseException`.
parent 24ce3ecb
......@@ -25,11 +25,10 @@ import reactor.ipc.netty.http.server.HttpServerOptions;
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory;
import org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactoryTests;
import org.springframework.boot.web.server.PortInUseException;
import org.springframework.boot.web.server.WebServerException;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
......@@ -48,15 +47,13 @@ public class NettyReactiveWebServerFactoryTests
}
@Test
public void portInUseExceptionIsThrownWhenPortIsAlreadyInUse() {
public void exceptionIsThrownWhenPortIsAlreadyInUse() {
AbstractReactiveWebServerFactory factory = getFactory();
factory.setPort(0);
this.webServer = factory.getWebServer(new EchoHandler());
this.webServer.start();
factory.setPort(this.webServer.getPort());
this.thrown.expect(PortInUseException.class);
this.thrown.expectMessage(
equalTo("Port " + this.webServer.getPort() + " is already in use"));
this.thrown.expect(WebServerException.class);
factory.getWebServer(new EchoHandler()).start();
}
......
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