public void setUp() throws Exception { super.setUp(); HashMap<Feature, Object> features = new HashMap<>(); LineString lineString = new LineString(new ArrayList<>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 50)))); Feature feature1 = new Feature(lineString, null, null); Point point = new Point(new LatLng(0, 0)); Feature feature2 = new Feature(point, null, null); features.put(feature1, null); features.put(feature2, null); featureSet = features.keySet(); mRenderer = new Renderer(mMap1, features); }
public void testAddFeature() throws Exception { Point p = new Point(new LatLng(30, 50)); Feature feature1 = new Feature(p, null, null); mRenderer.addFeature(feature1); assertTrue(mRenderer.getFeatures().contains(feature1)); }
public void testRemoveFeature() throws Exception { Point p = new Point(new LatLng(40, 50)); Feature feature1 = new Feature(p, null, null); mRenderer.addFeature(feature1); mRenderer.removeFeature(feature1); assertFalse(mRenderer.getFeatures().contains(feature1)); }
public void testProperty() throws Exception { HashMap<String, String> properties = new HashMap<>(); properties.put("Color", "Red"); properties.put("Width", "3"); feature = new Feature(null, null, properties); assertFalse(feature.hasProperty("llama")); assertTrue(feature.hasProperty("Color")); assertEquals("Red", feature.getProperty("Color")); assertTrue(feature.hasProperty("Width")); assertEquals("3", feature.getProperty("Width")); assertNull(feature.removeProperty("banana")); assertEquals("3", feature.removeProperty("Width")); assertNull(feature.setProperty("Width", "10")); assertEquals("10", feature.setProperty("Width", "500")); }
public void testGeometry() { feature = new Feature(null, null, null); assertNull(feature.getGeometry()); Point point = new Point(new LatLng(0, 0)); feature.setGeometry(point); assertEquals(point, feature.getGeometry()); feature.setGeometry(null); assertNull(feature.getGeometry()); LineString lineString = new LineString(new ArrayList<>(Arrays.asList(new LatLng(0, 0), new LatLng(50, 50)))); feature = new Feature(lineString, null, null); assertEquals(lineString, feature.getGeometry()); feature.setGeometry(point); assertEquals(point, feature.getGeometry()); feature.setGeometry(null); assertNull(feature.getGeometry()); feature.setGeometry(lineString); assertEquals(lineString, feature.getGeometry()); }