@Test
public void updateUriPort() {

    int port = 8000;
    int newPort = 10000;
    URI original = UriUtils.buildUri("http://localhost:8000/somePath?someQuery");
    assertEquals(null, UriUtils.updateUriPort(null, 0));
    assertEquals(original.getPort(), UriUtils.updateUriPort(original, port).getPort());
    URI newUri = UriUtils.updateUriPort(original, newPort);
    assertEquals(newPort, newUri.getPort());
    assertEquals(original.getHost(), newUri.getHost());
    assertEquals(original.getScheme(), newUri.getScheme());
    assertEquals(original.getPath(), newUri.getPath());
    assertEquals(original.getQuery(), newUri.getQuery());
}