diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2022-04-02 13:53:47 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2022-04-03 14:26:07 +0200 |
commit | ee24d9536c90a0d9e8367cb9ec8b07f138433bf3 (patch) | |
tree | 4b75a0fe567cb5f3648442e3421f24376d261199 /container-core/src/test/java/com/yahoo/restapi | |
parent | 27ba6c72cdb92cd648680dc5df3e0d7e388ad3c6 (diff) |
Add HttpURL with Path and Query inner classes
Diffstat (limited to 'container-core/src/test/java/com/yahoo/restapi')
-rw-r--r-- | container-core/src/test/java/com/yahoo/restapi/HttpURLTest.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/restapi/HttpURLTest.java b/container-core/src/test/java/com/yahoo/restapi/HttpURLTest.java new file mode 100644 index 00000000000..00da850d739 --- /dev/null +++ b/container-core/src/test/java/com/yahoo/restapi/HttpURLTest.java @@ -0,0 +1,32 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.restapi; + +import org.junit.jupiter.api.Test; + +import java.net.URI; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author jonmv + */ +class HttpURLTest { + + @Test + void testConversion() { + for (String uri : List.of("http://minimal", + "http://empty.query?", + "http://zero-port:0?no=path", + "http://only-path/", + "https://strange/queries?=&foo", + "https://weirdness?=foo", + "https://encoded/%3F%3D%26%2F?%3F%3D%26%2F=%3F%3D%26%2F", + "https://host.at.domain:123/one/two/?three=four&five")) + assertEquals(uri, HttpURL.from(URI.create(uri)).asURI().toString(), + "uri '" + uri + "' should be returned unchanged"); + } + +} |