Esempio n. 1
0
 /**
  * The URL instance must be able to add different query parameters that is added in the query
  * string
  */
 @Test
 public void testCanAddQueryParametersThatIsAddedInTheQueryString() {
   assertSame(url, url.addQueryParam("key", "value"));
   assertThat(url.getUrl(), startsWith(this.baseUrl + "/resource?key=value&accessToken="));
   assertThat(
       url.getUrlEncoded(), startsWith(this.baseUrl + "/resource?key=value&accessToken="));
 }
Esempio n. 2
0
  /** The URL instance must be able to reset the added query parameters */
  @Test
  public void testAddMultipleQueryParamsAndReset() {
    assertSame(url, url.addQueryParam("t[]", "border"));
    assertSame(url, url.addQueryParam("query", "{\"foo\":\"bar\"}"));

    assertThat(
        url.getUrl(),
        startsWith(
            "http://imbo/resource?t[]=border&query=%7B%22foo%22%3A%22bar%22%7D&accessToken="));

    assertThat(
        url.getUrlEncoded(),
        startsWith(
            "http://imbo/resource?t%5B%5D=border&query=%7B%22foo%22%3A%22bar%22%7D&accessToken="));

    assertSame(url, url.reset());

    assertThat(url.getUrlEncoded(), startsWith("http://imbo/resource?accessToken="));
  }