@Test public void testWithNull() throws Exception { SimpleFeatureSource source = getFeatureSource(MockData.BASIC_POLYGONS); SimpleFeatureCollection fc = source.getFeatures(); SimpleFeatureIterator i = fc.features(); try { SimpleFeature f = (SimpleFeature) i.next(); FeatureTemplate template = new FeatureTemplate(); template.description(f); // set a value to null f.setAttribute(1, null); try { template.description(f); } catch (Exception e) { e.printStackTrace(); fail("template threw exception on null value"); } } finally { i.close(); } }
@Test public void testWithDateAndBoolean() throws Exception { SimpleFeatureSource source = getFeatureSource(MockData.PRIMITIVEGEOFEATURE); SimpleFeatureCollection fc = source.getFeatures(); SimpleFeatureIterator i = fc.features(); try { SimpleFeature f = (SimpleFeature) i.next(); FeatureTemplate template = new FeatureTemplate(); try { template.description(f); } catch (Exception e) { e.printStackTrace(); fail("template threw exception on null value"); } } finally { i.close(); } }