Location implements Serializable { public QueryParameters getQueryParameters() { return queryParameters; } Location(String location);  Location(String location, QueryParameters queryParameters);  Location(List<String> segments);  Location(List<String> segments, QueryParameters queryParameters); List<String> getSegments(); QueryParameters getQueryParameters(); String getFirstSegment(); Optional<Location> getSubLocation(); String getPath(); String getPathWithQueryParameters(); Location toggleTrailingSlash();  }
@Test(expected = IllegalArgumentException.class) public void locationWithParamsInUrlAndParameters() { new Location("foo/bar/?one&two=222", getQueryParameters()); }
@Test public void locationWithParamWithAndWithoutValue() { Location location = new Location("foo?param&param=bar"); Assert.assertEquals("param&param=bar", location.getQueryParameters().getQueryString()); location = new Location("foo?param=bar&param"); Assert.assertEquals("param=bar&param", location.getQueryParameters().getQueryString()); }
@Test public void locationWithParamAndEmptyValue() { Location location = new Location("foo?param=&param=bar"); Assert.assertEquals("param=&param=bar", location.getQueryParameters().getQueryString()); }
@Test public void locationWithUrlEncodedCharacters() { Location location = new Location("foo?bar=a%20b%20%C3%B1%20%26%20%3F"); Assert.assertEquals("bar=a b ñ & ?", location.getQueryParameters().getQueryString()); }