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:
parent
fe0f9ebc9d
commit
edb075b611
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue