@SuppressWarnings("nls")
@Test
public void testCreateCapabilities() throws MalformedURLException, UnsupportedEncodingException {

    final String parametrizedUrl = "https://excise.pyr.ec.gc.ca:8081/cgi-bin/mapserv.exe?map=/LocalApps/Mapsurfer/PYRWQMP.map&service=WFS&version=1.0.0&request=GetCapabilities";
    URL url = WFSDataStoreFactory.createGetCapabilitiesRequest(new URL(parametrizedUrl));
    assertNotNull(url);
    assertEquals("https", url.getProtocol());
    assertEquals("excise.pyr.ec.gc.ca", url.getHost());
    assertEquals(8081, url.getPort());
    assertEquals("/cgi-bin/mapserv.exe", url.getPath());
    String query = url.getQuery();
    assertNotNull(query);
    Map<String, String> kvpMap = new HashMap<String, String>();
    String[] kvpPairs = query.split("&");
    for (String kvp : kvpPairs) {
        assertTrue(kvp.indexOf('=') > 0);
        String[] split = kvp.split("=");
        String param = split[0];
        String value = split[1];
        value = URLDecoder.decode(value, "UTF-8");
        assertFalse(kvpMap.containsKey(param));
        kvpMap.put(param.toUpperCase(), value);
    }
    assertEquals("/LocalApps/Mapsurfer/PYRWQMP.map", kvpMap.get("MAP"));
    assertEquals("GetCapabilities", kvpMap.get("REQUEST"));
    assertEquals("WFS", kvpMap.get("SERVICE"));
    assertEquals("1.0.0", kvpMap.get("VERSION"));
}