@Test
public void testIssueGetFeature_GET_OptionalParameters() throws Exception {

    final InputStream responseContent = TestData.openStream(this, GEOS_ARCHSITES.DATA);
    final TestHttpResponse httpResponse;
    final String defaultWfs11OutputFormat = "text/xml; subtype=gml/3.1.1";
    httpResponse = new TestHttpResponse(defaultWfs11OutputFormat, "UTF-16", responseContent);
    TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
    createTestProtocol(GEOS_ARCHSITES.CAPABILITIES, mockHttp, new GeoServerStrategy());
    Query query = new Query(GEOS_ARCHSITES.FEATURETYPENAME);
    query.setMaxFeatures(1000);
    query.setPropertyNames(new String[] { "cat", "the_geom" });
    query.setCoordinateSystem(CRS.decode("EPSG:23030"));
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
    Filter filter = ff.id(Collections.singleton(ff.featureId("archsites.1")));
    query.setFilter(filter);
    WFSResponse response;
    wfs.setDescribeFeatureTypeURLOverride(TestData.url(this, GEOS_ARCHSITES.SCHEMA));
    GetFeature getFeature = new GetFeatureQueryAdapter(query, defaultWfs11OutputFormat,
            "EPSG:26713", ResultType.RESULTS);
    response = wfs.issueGetFeatureGET(getFeature);
    assertNotNull(response);
    
    Map<String, String> kvp = requestKvp(mockHttp.targetUrl);
    assertEquals("1000", kvp.get("MAXFEATURES"));
    String propertyName = kvp.get("PROPERTYNAME");
    assertEquals("cat,the_geom", propertyName);
    String srsName = kvp.get("SRSNAME");
    // 23030 is not in the caps, so we assume its not supported
    // assertEquals("EPSG:23030", srsName);
    assertEquals("EPSG:26713", srsName);
    assertEquals("archsites.1", kvp.get("FEATUREID"));
    assertNull("FEATUREID and FILTER are mutually exclusive", kvp.get("FILTER"));
    // now try with a non feature id filter
    filter = ff.equals(ff.property("cat"), ff.literal(1));
    query.setFilter(filter);
    getFeature = new GetFeatureQueryAdapter(query, defaultWfs11OutputFormat, "EPSG:23030",
            ResultType.RESULTS);
    response = wfs.issueGetFeatureGET(getFeature);
    kvp = requestKvp(mockHttp.targetUrl);
    assertNull("FEATUREID and FILTER are mutually exclusive", kvp.get("FEATUREID"));
    String encodedFilter = kvp.get("FILTER");
    assertNotNull(encodedFilter);
    Parser filterParser = new Parser(new OGCConfiguration());
    Filter parsed = (Filter) filterParser.parse(new StringReader(encodedFilter));
    assertTrue(parsed instanceof PropertyIsEqualTo);
}