### Question:
WKTValueProvider { public String getWKTValue(DataElement element) { String wktGeometry = null; if (myExportModel.isAddWkt() && element instanceof MapDataElement) { MapGeometrySupport support = ((MapDataElement)element).getMapGeometrySupport(); if (support != null) { Geometry g = GeometrySupportToJTSGeometryFactory.convertToJTSGeometry(support, myGeometryFactory); wktGeometry = myWriter.write(g); } } return wktGeometry; } WKTValueProvider(ExportOptionsModel exportModel); String getWKTValue(DataElement element);  }### Answer:
@Test public void testGetWKTValue() { EasyMockSupport support = new EasyMockSupport(); DefaultMapPointGeometrySupport point = new DefaultMapPointGeometrySupport(LatLonAlt.createFromDegrees(10.1, 11.1)); DefaultMapDataElement element = new DefaultMapDataElement(ourFeatureId, point); support.replayAll(); ExportOptionsModel model = new ExportOptionsModel(); model.setAddWkt(true); WKTValueProvider provider = new WKTValueProvider(model); String wktPoint = provider.getWKTValue(element); assertEquals("POINT (11.1 10.1)", wktPoint); support.verifyAll(); }
@Test public void testNoAddWkt() { EasyMockSupport support = new EasyMockSupport(); DefaultMapPointGeometrySupport point = new DefaultMapPointGeometrySupport(LatLonAlt.createFromDegrees(10.1, 11.1)); DefaultMapDataElement element = new DefaultMapDataElement(ourFeatureId, point); support.replayAll(); ExportOptionsModel model = new ExportOptionsModel(); WKTValueProvider provider = new WKTValueProvider(model); String wktPoint = provider.getWKTValue(element); assertNull(wktPoint); support.verifyAll(); }
@Test public void testNoGeometry() { EasyMockSupport support = new EasyMockSupport(); DefaultDataElement element = new DefaultDataElement(ourFeatureId); support.replayAll(); ExportOptionsModel model = new ExportOptionsModel(); model.setAddWkt(true); WKTValueProvider provider = new WKTValueProvider(model); String wktPoint = provider.getWKTValue(element); assertNull(wktPoint); support.verifyAll(); }