/** The URL instance must be able to set and get an access token instance */
  @Test
  public void testCanSetAndGetAnAccessTokenInstance() {
    final AccessToken accessToken = new AccessToken();

    assertSame(url, url.setAccessToken(accessToken));
    assertSame(accessToken, url.getAccessToken());
  }
 /**
  * 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="));
 }
  /** 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="));
  }
 /** The URL instance must create an access token if one does not exist when first accessed */
 @Test
 public void testCanAutomaticallyCreateAnAccessTokenInstanceIfOneIsNotSet() {
   assertThat(url.getAccessToken(), instanceOf(AccessToken.class));
 }