HibernateFeatureModel extends HibernateLayerUtil implements FeatureModel { @Override public Attribute getAttribute(Object feature, String name) throws LayerException { try { return entityMappingService.getAttribute(feature, getFeatureInfo(), entityMapper, name); } catch (GeomajasException e) { throw new LayerException(e); } }  @Override void setLayerInfo(VectorLayerInfo layerInfo); @Override Attribute getAttribute(Object feature, String name); @Override @SuppressWarnings("rawtypes") Map<String, Attribute> getAttributes(Object feature); @Override String getId(Object feature); @Override Geometry getGeometry(Object feature); @Override @SuppressWarnings("unchecked") void setAttributes(Object feature, Map<String, Attribute> attributes); @Override void setGeometry(Object feature, Geometry geometry); @Override Object newInstance(); @Override Object newInstance(String id); @Override int getSrid(); @Override String getGeometryAttributeName(); @Override boolean canHandle(Object feature);  }
@Test public void getIdAttributeLong() throws Exception { Assert.assertEquals(1L, featureModel.getAttribute(feature1, PARAM_ID_ATTR).getValue()); }
@Test public void getAttributeText() throws Exception { Assert.assertEquals("default-name-1", featureModel.getAttribute(feature1, PARAM_TEXT_ATTR).getValue()); }
@Test public void getAttributeInteger() throws Exception { Assert.assertEquals(10, featureModel.getAttribute(feature1, PARAM_INT_ATTR).getValue()); }
@Test public void getAttributeFloat() throws Exception { Assert.assertEquals(10.0f, featureModel.getAttribute(feature1, PARAM_FLOAT_ATTR).getValue()); }
@Test public void getAttributeDouble() throws Exception { Assert.assertEquals(10.0, featureModel.getAttribute(feature1, PARAM_DOUBLE_ATTR).getValue()); }
@Test public void getAttributeBoolean() throws Exception { Assert.assertEquals(true, featureModel.getAttribute(feature1, PARAM_BOOLEAN_ATTR).getValue()); }
@Test public void getAttributeDate() throws Exception { DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); Date date; date = format.parse("01/01/2009"); Assert.assertEquals(date, featureModel.getAttribute(feature1, PARAM_DATE_ATTR).getValue()); }
@Test public void getAttributeManyToOne() throws Exception { DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); Date date; try { date = format.parse("01/01/2009"); } catch (ParseException e) { date = new Date(); } Object value = featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE); Assert.assertTrue(value instanceof ManyToOneAttribute); Assert.assertTrue(((ManyToOneAttribute) value).isEmpty() == false); Assert.assertEquals("manyToOne-1", featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_TEXT_ATTR).getValue()); Assert.assertEquals(100, featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_INT_ATTR).getValue()); Assert.assertEquals(100.0f, featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_FLOAT_ATTR).getValue()); Assert.assertEquals(100.0, featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_DOUBLE_ATTR).getValue()); Assert.assertEquals(true, featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_BOOLEAN_ATTR).getValue()); Assert.assertEquals(date, featureModel.getAttribute(feature1, PARAM_MANY_TO_ONE + HibernateLayerUtil.SEPARATOR + PARAM_DATE_ATTR).getValue()); }