### Question:
BaseMapper { protected String constructNewUri(String uri, String newUri) { QueryStringDecoder decoder = new QueryStringDecoder(uri); QueryStringDecoder internalUrldecoder = new QueryStringDecoder(newUri); Map<String, List<String>> queryParams = decoder.getParameters(); Map<String, List<String>> internalQueryParams = internalUrldecoder.getParameters(); QueryStringEncoder encoder = new QueryStringEncoder(internalUrldecoder.getPath()); for (String key : queryParams.keySet()) { for (String value : queryParams.get(key)) { encoder.addParam(key, value); } } for (String key : internalQueryParams.keySet()) { for (String value : internalQueryParams.get(key)) { encoder.addParam(key, value); } } return encoder.toString(); }  HttpRequest map(HttpRequest req, String internalURI);  }### Answer:
@Test public void when_query_params_add_it_to_internal_uri() throws Exception { String uri = "/validation/mobile?mobile=89343430&code=359"; String newUri = "/user/validation/mobile"; String resultUri = mapper.constructNewUri(uri, newUri); assertEquals(resultUri, "/user/validation/mobile?mobile=89343430&code=359"); }
@Test public void when_internal_uri_has_query_params_should_mix_with_external_ones(){ String newUri = mapper.constructNewUri("http: assertEquals(newUri, "http: }