### Question:
CreateMeasure extends AnnotationType { @Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getField() ) && ( StringUtils.isBlank( getLevel() ) || StringUtils.isBlank( getCube() ) ) && ( StringUtils.isBlank( getMeasure() ) || StringUtils.isBlank( getCube() ) ) ) { throw new ModelerException( BaseMessages .getString( MSG_CLASS, "ModelAnnotation.CreateMeasure.validation.FIELD_OR_LEVEL_NOT_PROVIDED" ) ); } if ( StringUtils.isBlank( getName() ) ) { throw new ModelerException( BaseMessages .getString( MSG_CLASS, "ModelAnnotation.CreateMeasure.validation.MEASURE_NAME_REQUIRED" ) ); } }  String getName(); void setName( String name ); AggregationType getAggregateType(); void setAggregateType( AggregationType aggregateType ); String getFormatString(); void setFormatString( String formatString ); String getDescription(); void setDescription( String description ); String getBusinessGroup(); void setBusinessGroup( String businessGroup ); @Override String getField(); void setField( String field ); String getLevel(); void setLevel( String level ); String getMeasure(); void setMeasure( String measure ); String getCube(); void setCube( String cube ); boolean isHidden(); void setHidden( boolean hidden ); @Override boolean apply(
      final ModelerWorkspace workspace, final IMetaStore metaStore ); @Override boolean apply( Document doc ); @Override void populate( final Map<String, Serializable> propertiesMap ); @Override ModelAnnotation.Type getType(); @Override String getSummary(); @Override void validate(); static final String NAME_ID; static final String NAME_NAME; static final int NAME_ORDER; static final String AGGREGATE_TYPE_ID; static final String AGGREGATE_TYPE_NAME; static final int AGGREGATE_TYPE_ORDER; static final String FORMAT_STRING_ID; static final String FORMAT_STRING_NAME; static final int FORMAT_STRING_ORDER; static final String DESCRIPTION_ID; static final String DESCRIPTION_NAME; static final int DESCRIPTION_ORDER; static final String BUSINESS_GROUP_ID; static final String BUSINESS_GROUP_NAME; static final int BUSINESS_GROUP_ORDER; static final String FIELD_ID; static final String FIELD_NAME; static final int FIELD_ORDER; static final String LEVEL_ID; static final String LEVEL_NAME; static final int LEVEL_ORDER; static final String MEASURE_ID; static final String MEASURE_NAME; static final int MEASURE_ORDER; static final String CUBE_ID; static final String CUBE_NAME; static final int CUBE_ORDER; static final String HIDDEN_ID; static final String HIDDEN_NAME; static final int HIDDEN_ORDER; static final String MDI_GROUP; }### Answer:
@Test public void testValidate() throws Exception { CreateMeasure createMeasure = new CreateMeasure(); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } createMeasure.setName( "name" ); createMeasure.setField( "field" ); createMeasure.validate(); createMeasure.setField( "" ); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } createMeasure.setName( "name" ); createMeasure.setLevel( "level" ); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } createMeasure.setCube( "cube" ); createMeasure.validate(); createMeasure.setLevel( "" ); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } createMeasure.setMeasure( "measure" ); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } createMeasure.setCube( "" ); try { createMeasure.validate(); } catch ( ModelerException me ) { assertNotNull( me ); } }