@Test
public void shouldAppendEncodedQueryParams() {

    Map<String, Object> queryParams = new HashMap<String, Object>() {{
        put("key1", "value");
        put("key2", "value?& <3");
        put("key3", "¯\\_(ツ)_/¯");
    }};
    String encodedEntry1 = "key1=value";
    String encodedEntry2 = "key2=value%3F%26+%3C3";
    String encodedEntry3 = "key3=%C2%AF%5C_%28%E3%83%84%29_%2F%C2%AF";
    URL result = builder.getDatasetsUrl(PROJECT_ID, DATASET, true, queryParams);
    assertThat(result.getQuery().length(), equalTo(encodedEntry1.length() + encodedEntry2.length() + encodedEntry3.length() + 2));
    assertThat(result.getQuery(), containsString(encodedEntry1));
    assertThat(result.getQuery(), containsString(encodedEntry2));
    assertThat(result.getQuery(), containsString(encodedEntry3));
}