dataHandle.addTOC( "toc1" ); TOCHandle tocHandle = dataHandle.getTOC( ); assertNotNull( tocHandle );  dataHandle.addTOC( (String)null );  TOC toc = StructureFactory.createTOC("toc2"); dataHandle.addTOC( toc );  save(); assertTrue( compareFile( "ReportItemParseTest_2_golden.xml"));
	public void testWriteProperties( ) throws Exception	{		LabelHandle labelHandle = (LabelHandle) designHandle				.findElement( "bodyLabel" ); //$NON-NLS-1$		labelHandle.setZIndex( 1 );		labelHandle.setOnCreate( "my new label on create" ); //$NON-NLS-1$		labelHandle.setOnRender( null );		labelHandle.setOnPrepare( "my new label on prepare" ); //$NON-NLS-1$		labelHandle.setOnPageBreak( "my new label on page break" ); //$NON-NLS-1$		Iterator rules = labelHandle.visibilityRulesIterator( );		// sets with the first visibility rule.		StructureHandle structHandle = (StructureHandle) rules.next( );		assertNotNull( structHandle );		MemberHandle memberHandle = structHandle				.getMember( HideRule.FORMAT_MEMBER );		memberHandle.setValue( DesignChoiceConstants.FORMAT_TYPE_REPORTLET );		// visibility rule now support user defined format, no exception		memberHandle.setValue( "userDefinedformat" ); //$NON-NLS-1$				memberHandle = structHandle.getMember( HideRule.VALUE_EXPR_MEMBER );		memberHandle.setValue( "10*20" ); //$NON-NLS-1$		labelHandle.setTocExpression( "new 2005 statistics" ); //$NON-NLS-1$		DataItemHandle dataHandle = (DataItemHandle) designHandle				.findElement( "bodyData" ); //$NON-NLS-1$			dataHandle.setOnCreate( "my new data on create" ); //$NON-NLS-1$		dataHandle.setOnRender( "my new data on render" ); //$NON-NLS-1$		dataHandle.setOnPrepare( null );		dataHandle.setEventHandlerClass( "my new data handler class" ); //$NON-NLS-1$		rules = dataHandle.visibilityRulesIterator( );		// get the second visibility rule handle.		structHandle = (StructureHandle) rules.next( );		structHandle = (StructureHandle) rules.next( );		assertNotNull( structHandle );		memberHandle = structHandle.getMember( HideRule.FORMAT_MEMBER );		memberHandle.setValue( DesignChoiceConstants.FORMAT_TYPE_REPORTLET );		memberHandle = structHandle.getMember( HideRule.VALUE_EXPR_MEMBER );		memberHandle.setValue( "bodyData 2nd rule." ); //$NON-NLS-1$		// no expression originally, now add one expression.		structHandle = (StructureHandle) rules.next( );		assertNull( structHandle );		// writes bindings for data.		Iterator bindings = dataHandle.paramBindingsIterator( );		structHandle = (StructureHandle) bindings.next( );		assertNotNull( structHandle );		memberHandle = structHandle.getMember( ParamBinding.PARAM_NAME_MEMBER );		memberHandle.setValue( "no paramter 1" ); //$NON-NLS-1$		memberHandle = structHandle.getMember( ParamBinding.EXPRESSION_MEMBER );		memberHandle.setValue( "setting value 1" ); //$NON-NLS-1$		structHandle = (StructureHandle) bindings.next( );		assertNotNull( structHandle );		memberHandle = structHandle.getMember( ParamBinding.PARAM_NAME_MEMBER );		memberHandle.setValue( "no paramter 2" ); //$NON-NLS-1$		memberHandle = structHandle.getMember( ParamBinding.EXPRESSION_MEMBER );		memberHandle.setValue( "setting value 2" ); //$NON-NLS-1$		// clear toc on Data		dataHandle.setTocExpression( null );		save(); 		assertTrue( compareFile( "ReportItemParseTest_golden.xml") ); //$NON-NLS-1$	}