import static org.junit.Assert.*;
|
import java.net.InetAddress;
|
import org.junit.Test;
|
import com.mongodb.ServerAddress;
|
|
public class ServerAddressUnitTests {
|
|
@Test
|
public void hostAndPortStringIPv6AddressShouldWork() throws Exception {
|
|
ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]:27017");
|
|
assertEquals(27017, serverAddress.getPort());
|
assertEquals("dead:beef:affe::1", serverAddress.getHost());
|
}
|
|
@Test
|
public void hostAndPortIPv6AddressShouldWork() throws Exception {
|
|
ServerAddress serverAddress = new ServerAddress("[dead:beef:affe::1]", 27017);
|
|
assertEquals(27017, serverAddress.getPort());
|
assertEquals("dead:beef:affe::1", serverAddress.getHost());
|
}
|
|
@Test
|
public void inetAddressIPv6AddressShouldWork() throws Exception {
|
|
ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1"));
|
|
assertEquals(27017, serverAddress.getPort());
|
assertEquals("dead:beef:affe::1", serverAddress.getHost());
|
}
|
|
@Test
|
public void inetAddressAndPortIPv6AddressShouldWork() throws Exception {
|
|
ServerAddress serverAddress = new ServerAddress(InetAddress.getByName("dead:beef:affe::1"), 27017);
|
|
assertEquals(27017, serverAddress.getPort());
|
assertEquals("dead:beef:affe::1", serverAddress.getHost());
|
}
|
}
|