ModelUtils { public static String getPropertyValue( AbstractBlockHolder holder, String propertyName ) { BlockProperty p = holder.findPropertyBlockByName( propertyName ); return p == null ? null : p.getValue(); } private  ModelUtils(); static String getPropertyValue( AbstractBlockHolder holder, String propertyName ); static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ); static Map<String,String> getData( AbstractBlockHolder holder ); static Map<String,ExportedVariable> getExportedVariables( AbstractBlockHolder holder ); static Map<String,ExportedVariable> findExportedVariables( String exportedVariablesDecl, File sourceFile, int lineNumber );  }
@Test public void testGetPropertyValue() { FileDefinition def = new FileDefinition( null ); AbstractBlockHolder holder = new BlockFacet( def ); holder.getInnerBlocks().add( new BlockProperty( def, "name", "value" )); holder.getInnerBlocks().add( new BlockProperty( def, "address", null )); holder.getInnerBlocks().add( new BlockProperty( def, "age", "30" )); holder.getInnerBlocks().add( new BlockProperty( def, "alias", "" )); Assert.assertEquals( "value", ModelUtils.getPropertyValue( holder, "name" )); Assert.assertEquals( "30", ModelUtils.getPropertyValue( holder, "age" )); Assert.assertEquals( "", ModelUtils.getPropertyValue( holder, "alias" )); Assert.assertNull( ModelUtils.getPropertyValue( holder, "address" )); Assert.assertNull( ModelUtils.getPropertyValue( holder, "oops" )); }