DATAMONGO-2130 - Polishing.
Set timeout for InetAdress host lookup to reduce test execution time. Original pull request: #618.
This commit is contained in:
committed by
Mark Paluch
parent
622643bf24
commit
dd2af6462d
@@ -18,6 +18,7 @@ package org.springframework.data.mongodb.config;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
@@ -124,7 +125,8 @@ public class ServerAddressPropertyEditorUnitTests {
|
||||
* We can't tell whether the last part of the hostAddress represents a port or not.
|
||||
*/
|
||||
@Test // DATAMONGO-808
|
||||
public void shouldFailToHandleAmbiguousIPv6HostaddressLongWithoutPortAndWithoutBrackets() throws UnknownHostException {
|
||||
public void shouldFailToHandleAmbiguousIPv6HostaddressLongWithoutPortAndWithoutBrackets()
|
||||
throws UnknownHostException {
|
||||
|
||||
expectedException.expect(IllegalArgumentException.class);
|
||||
|
||||
@@ -173,9 +175,9 @@ public class ServerAddressPropertyEditorUnitTests {
|
||||
|
||||
for (String hostname : hostnames) {
|
||||
try {
|
||||
InetAddress.getByName(hostname);
|
||||
InetAddress.getByName(hostname).isReachable(1500);
|
||||
Assert.fail("Supposedly unresolveable hostname '" + hostname + "' can be resolved.");
|
||||
} catch (UnknownHostException expected) {
|
||||
} catch (IOException expected) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user