@Test
 public void testSearchByPoint() throws Exception {
   String layer = "layerWmsCountries";
   SearchByPointRequest request = new SearchByPointRequest();
   request.setBbox(
       new Bbox(-3211986.0066263545, 98246.25012821658, 1.065471024672729E7, 3365675.229452881));
   request.setCrs("EPSG:900913");
   Map<String, String> layers = new HashMap<String, String>();
   layers.put(layer, layer);
   request.setLayerMapping(layers);
   request.setLocation(new Coordinate(672238.022713162, 2554015.0948743597));
   request.setScale(1.022083167709322E-4);
   CommandResponse response =
       dispatcher.execute(SearchByPointRequest.COMMAND, request, null, "en");
   Assert.assertFalse(response.isError());
   Assert.assertTrue(response instanceof SearchByPointResponse);
   SearchByPointResponse sbp = (SearchByPointResponse) response;
   Map<String, List<Feature>> map = sbp.getFeatureMap();
   Assert.assertNotNull(map);
   List<Feature> features = map.get(layer);
   Assert.assertEquals(1, features.size());
   Feature feature = features.get(0);
   Assert.assertEquals("belt.2", feature.getId());
   Assert.assertEquals("Tropical", feature.getAttributes().get("BELT").getValue());
   Assert.assertEquals("2", feature.getAttributes().get("FID").getValue());
 }
  @Test
  public void testDeselectLayer() {
    org.geomajas.layer.feature.Feature dto1 = new org.geomajas.layer.feature.Feature();
    dto1.setId("feat1");
    Feature feature1 = new Feature(dto1, layer1);

    org.geomajas.layer.feature.Feature dto2 = new org.geomajas.layer.feature.Feature();
    dto2.setId("feat2");
    Feature feature2 = new Feature(dto2, layer1);

    Assert.assertFalse(feature1.isSelected());
    Assert.assertFalse(feature2.isSelected());
    Assert.assertEquals(0, selectedCount);
    Assert.assertEquals(0, deselectedCount);

    mapModel.selectLayer(layer1);
    Assert.assertFalse(feature1.isSelected());
    Assert.assertFalse(feature2.isSelected());
    Assert.assertEquals(0, selectedCount);
    Assert.assertEquals(0, deselectedCount);

    layer1.selectFeature(feature1);
    layer1.selectFeature(feature2);
    Assert.assertTrue(feature1.isSelected());
    Assert.assertTrue(feature2.isSelected());
    Assert.assertEquals(2, selectedCount);
    Assert.assertEquals(0, deselectedCount);

    mapModel.selectLayer(layer1);
    Assert.assertTrue(feature1.isSelected());
    Assert.assertTrue(feature2.isSelected());
    Assert.assertEquals(2, selectedCount);
    Assert.assertEquals(0, deselectedCount);

    mapModel.selectLayer(layer2);
    Assert.assertTrue(feature1.isSelected());
    Assert.assertTrue(feature2.isSelected());
    Assert.assertEquals(2, selectedCount);
    Assert.assertEquals(0, deselectedCount);
  }
  @Test
  public void testSelectDeselectFeature() {
    org.geomajas.layer.feature.Feature dto1 = new org.geomajas.layer.feature.Feature();
    dto1.setId("feat1");
    Feature feature1 = new Feature(dto1, layer1);

    org.geomajas.layer.feature.Feature dto2 = new org.geomajas.layer.feature.Feature();
    dto2.setId("feat2");
    Feature feature2 = new Feature(dto2, layer1);

    Assert.assertFalse(feature1.isSelected());
    Assert.assertFalse(feature2.isSelected());
    Assert.assertEquals(0, selectedCount);
    Assert.assertEquals(0, deselectedCount);
    Assert.assertNull(lastFeatureId);

    layer1.selectFeature(feature1);
    Assert.assertTrue(feature1.isSelected());
    Assert.assertFalse(feature2.isSelected());
    Assert.assertEquals(1, selectedCount);
    Assert.assertEquals(0, deselectedCount);
    Assert.assertEquals("feat1", lastFeatureId);
    lastFeatureId = null;

    layer1.selectFeature(feature2);
    Assert.assertTrue(feature1.isSelected());
    Assert.assertTrue(feature2.isSelected());
    Assert.assertEquals(2, selectedCount);
    Assert.assertEquals(0, deselectedCount);
    Assert.assertEquals("feat2", lastFeatureId);

    layer1.deselectFeature(feature1);
    Assert.assertFalse(feature1.isSelected());
    Assert.assertTrue(feature2.isSelected());
    Assert.assertEquals(2, selectedCount);
    Assert.assertEquals(1, deselectedCount);
    Assert.assertEquals("feat1", lastFeatureId);
  }