Testing for BindException cause as well

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2018-10-19 10:38:09 -05:00
parent 35ea653f73
commit 9e84c1ee93
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.net.BindException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
@ -318,6 +319,7 @@ public class ServerConnectorTest
server.setHandler(handlers);
IOException x = assertThrows(IOException.class, () -> server.start());
assertThat(x.getCause(), instanceOf(BindException.class));
assertThat(x.getMessage(), containsString("0.0.0.0:" + port));
}
}