InfoToolResult { public void setFeatureValue(Name name, Object value) { if (currentItem == null) { throw new IllegalStateException("Missing prior call to newFeature method"); } currentItem.put(name.toString(), value); } InfoToolResult(); void newFeature(String id); void setFeatureValue(Name name, Object value); void setFeatureValue(String name, Object value); int getNumFeatures(); @Override String toString(); Map<String, Object> getFeatureData(int featureIndex); String getFeatureId(int featureIndex);  }
@Test(expected=IllegalStateException.class) public void missingNewFeatureCall() { result.setFeatureValue("foo", 0); }