### Question:
AnnotationType implements Serializable { protected String resolveFieldFromLevel( final ModelerWorkspace modelerWorkspace, final String levelName, final String cubeName ) throws ModelerException { if ( StringUtils.isBlank( levelName ) || StringUtils.isBlank( cubeName ) || modelerWorkspace == null ) { throw new ModelerException( BaseMessages.getString( "ModelAnnotation.resolveField.UNABLE_TO_FIND_LEVEL", levelName ) ); } String locale = Locale.getDefault().toString(); OlapCube olapCube = getOlapCube( modelerWorkspace, cubeName ); if ( olapCube == null ) { throw new ModelerException( BaseMessages.getString( "ModelAnnotation.resolveField.UNABLE_TO_FIND_CUBE", cubeName ) ); } List usages = olapCube.getOlapDimensionUsages(); for ( int u = 0; u < usages.size(); u++ ) { OlapDimensionUsage usage = (OlapDimensionUsage) usages.get( u ); OlapDimension olapDimension = usage.getOlapDimension(); List olapHierarchies = olapDimension.getHierarchies(); for ( int h = 0; h < olapHierarchies.size(); h++ ) { StringBuffer buffer = new StringBuffer(); buffer.append( "[" ); buffer.append( usage.getName() ); OlapHierarchy olapHierarchy = (OlapHierarchy) olapHierarchies.get( h ); if ( StringUtils.isNotEmpty( olapHierarchy.getName() ) && !StringUtils.equals( olapHierarchy.getName(), usage.getName() ) ) { buffer.append( "." ).append( olapHierarchy.getName() ); } buffer.append( "].[" ); List hierarchyLevels = olapHierarchy.getHierarchyLevels(); for ( int hl = 0; hl < hierarchyLevels.size(); hl++ ) { OlapHierarchyLevel olapHierarchyLevel = (OlapHierarchyLevel) hierarchyLevels.get( hl ); if ( levelName.equals( buffer.toString() + olapHierarchyLevel.getName() + "]" ) ) { return olapHierarchyLevel.getReferenceColumn().getName( locale ); } } } } throw new ModelerException( BaseMessages.getString( "ModelAnnotation.resolveField.UNABLE_TO_FIND_LEVEL", levelName ) ); }  List<String> getModelPropertyIds(); void setModelPropertyValueById( String id, Object value ); Object getModelPropertyValueById( String id ); Object getModelPropertyValueByName( String name ); Class getModelPropertyNameClassType( String name ); List<String> getModelPropertyNames(); List<ModelProperty> getModelProperties(); void setModelPropertyByName( String modelPropertyName, Object value ); Map<String, Serializable> describe(); void populate( final Map<String, Serializable> propertiesMap ); void iterateProperties( KeyValueClosure closure ); @Override boolean equals( Object obj ); @Override int hashCode(); abstract boolean apply(
      final ModelerWorkspace workspace, final IMetaStore metaStore ); abstract boolean apply( final Document schema ); abstract void validate(); abstract ModelAnnotation.Type getType(); abstract String getSummary(); abstract String getName(); abstract String getField(); boolean equalsLogically( AnnotationType obj );  }### Answer:
@Test public void testResolveFieldFromLevel() throws Exception { IMetaStore metaStore = new MemoryMetaStore(); ModelerWorkspace model = new ModelerWorkspace( new ModelerWorkspaceHelper( "" ) ); model.setDomain( new XmiParser().parseXmi( new FileInputStream( PRODUCT_XMI_FILE ) ) ); model.getWorkspaceHelper().populateDomain( model ); CreateAttribute productLine = new CreateAttribute(); productLine.setName( "Product Line" ); productLine.setDimension( "Products" ); productLine.setHierarchy( "Products" ); productLine.setLevel( "[PRODUCTLINE].[PRODUCTLINE]" ); productLine.setCube( "products_38GA" ); productLine.apply( model, metaStore ); assertEquals( "PRODUCTLINE_OLAP", productLine.getField() ); }