*/
@Test
public void testNoBBOXInHREF() throws Exception {
final String layerName = MockData.BASIC_POLYGONS.getPrefix() + ":"
+ MockData.BASIC_POLYGONS.getLocalPart();
final XpathEngine xpath = XMLUnit.newXpathEngine();
String requestURL = "wms/kml?mode=refresh&layers=" + layerName;
Document dom = getAsDOM(requestURL);
print(dom);
assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document)", dom);
assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document/kml:NetworkLink)", dom);
assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document/kml:LookAt)", dom);
assertXpathEvaluatesTo(layerName,
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:name", dom);
assertXpathEvaluatesTo("1", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:open",
dom);
assertXpathEvaluatesTo("1",
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:visibility", dom);
assertXpathEvaluatesTo("onStop",
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewRefreshMode",
dom);
assertXpathEvaluatesTo("1.0",
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewRefreshTime",
dom);
assertXpathEvaluatesTo("1.0",
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewBoundScale",
dom);
Map<String, Object> expectedKVP = KvpUtils
.parseQueryString("http://localhost:80/geoserver/wms?format_options=MODE%3Arefresh%3Bautofit%3Atrue%3BKMPLACEMARK%3Afalse%3BKMATTR%3Atrue%3BKMSCORE%3A40%3BSUPEROVERLAY%3Afalse&service=wms&srs=EPSG%3A4326&width=2048&styles=BasicPolygons&height=2048&transparent=false&request=GetMap&layers=cite%3ABasicPolygons&format=application%2Fvnd.google-earth.kml+xml&version=1.1.1");
Map<String, Object> resultedKVP = KvpUtils.parseQueryString(xpath.evaluate(
"kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom));
assertMapsEqual(expectedKVP, resultedKVP);
String href = xpath.evaluate(
"kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href", dom);
Pattern badPattern = Pattern.compile("&bbox=", Pattern.CASE_INSENSITIVE);
assertFalse(badPattern.matcher(href).matches());
}