Code example for Map

Methods: cleargetsize

0
    @Test 
    public void testDecodeQueryString() { 
        Map<String, String> params = newHashMap();
 
        String uri = "something?test=value";
        RestUtils.decodeQueryString(uri, uri.indexOf('?') + 1, params);
        assertThat(params.size(), equalTo(1));
        assertThat(params.get("test"), equalTo("value"));
 
        params.clear();
        uri = "something?test=value&test1=value1";
        RestUtils.decodeQueryString(uri, uri.indexOf('?') + 1, params);
        assertThat(params.size(), equalTo(2));
        assertThat(params.get("test"), equalTo("value"));
        assertThat(params.get("test1"), equalTo("value1"));
 
        params.clear();
        uri = "something";
        RestUtils.decodeQueryString(uri, uri.length(), params);
        assertThat(params.size(), equalTo(0));
 
        params.clear();
        uri = "something";
        RestUtils.decodeQueryString(uri, -1, params);
        assertThat(params.size(), equalTo(0));
    } 
 
    @Test 
    public void testDecodeQueryStringEdgeCases() { 
        Map<String, String> params = newHashMap();