| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.mmdemirbas.urlbuilder; |
||
| 10 | final class UrlBuilderJavaTest { |
||
| 11 | private final String URL = "http://foo.com/with%20spaces/path/with/varArgs/&=%3F%2F;matrix=param%3F?fancy%20%2B%20name=fancy?%3Dvalue#%23?="; |
||
| 12 | |||
| 13 | @Test |
||
| 14 | void fromSchemeAndHost() { |
||
| 15 | Assertions.assertEquals(URL, |
||
| 16 | UrlBuilder.from("http", "foo.com") |
||
| 17 | .addPath("with spaces") |
||
| 18 | .addPaths("path", "with", "varArgs") |
||
| 19 | .addPath("&=?/", pair("matrix", "param?")) |
||
| 20 | .setQuery(pair("fancy + name", "fancy?=value")) |
||
| 21 | .setFragment("#?=") |
||
| 22 | .toUrlString()); |
||
| 23 | } |
||
| 24 | |||
| 25 | @Test |
||
| 26 | void fromString() { |
||
| 27 | Assertions.assertEquals(URL, UrlBuilder.from(URL).toUrlString()); |
||
| 28 | } |
||
| 29 | |||
| 30 | @Test |
||
| 31 | void fromURL() throws Exception { |
||
| 32 | Assertions.assertEquals(URL, UrlBuilder.from(new URL(URL)).toUrlString()); |
||
| 33 | } |
||
| 35 |