/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.api;

import junit.framework.TestCase;

public class InstanceIDTest extends TestCase
{

	public void testParse( )
	{
		checkParse( "/32", "/32", "/32" );
		checkParse( "/32(dataSet:0)", "/32(dataSet:0)", "/32(dataSet:0)" );
		checkParse( "/32(dataSet:0)/3", "/3", "/32(dataSet:0)/3" );
		checkParse( "/32({dataSet}.3.group3:0)/4", "/4",
				"/32({dataSet}.3.group3:0)/4" );
		checkParse( "/32({dataSet}.3.group3:0)/1.4", "/1.4",
				"/32({dataSet}.3.group3:0)/1.4" );
	}

	protected void checkParse( String value, String id, String fid )
	{
		InstanceID iid = InstanceID.parse( value );
		assertEquals( id, iid.toString( ) );
		assertEquals( fid, iid.toUniqueString( ) );
	}
}
