Minor changes to RestUtils.decodeQueryString() tests

Testing

    RestUtils.decodeQueryString("something", "something".indexOf('?') + 1, params);

is not really checking decoding of an empty query.
Instead, it is testing decoding of "something"
as a query (because "something.index('?')+1" evaluates to 0).
The parameter map is left empty because
"malformed" pairs like "something" are currently skipped.

Instead, this change modify this test to check the edge cases:

+ fromIndex >= queryString.length()
+ fromIndex < 0
This commit is contained in:
Adriano Ferreira 2011-01-06 18:53:24 -02:00 committed by kimchy
parent fe0f9ebc9d
commit edb075b611
1 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,12 @@ public class RestUtilsTests {
params.clear(); params.clear();
uri = "something"; uri = "something";
RestUtils.decodeQueryString(uri, uri.indexOf('?') + 1, params); 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)); assertThat(params.size(), equalTo(0));
} }
} }