1   /*
2    *  soapUI, copyright (C) 2004-2009 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.rest;
14  
15  import com.eviware.soapui.impl.wsdl.WsdlProject;
16  import junit.framework.TestCase;
17  
18  public class RestResourceTestCase extends TestCase
19  {
20  	public void testGetTemplateParams() throws Exception
21  	{
22  		WsdlProject project = new WsdlProject();
23  		RestService restService = (RestService) project.addNewInterface("Test", RestServiceFactory.REST_TYPE );
24  		RestResource resource = restService.addNewResource("Resource", "/test" );
25  		
26  		assertEquals( resource.getDefaultParams().length, 0 );
27  		
28  		resource.setPath( "/{id}/test" );
29  		assertEquals( resource.getDefaultParams().length, 1 );
30  		assertEquals( "id", resource.getDefaultParams()[0].getName() );
31  		assertEquals( "/{id}/test", resource.getFullPath() );
32  		
33  		RestResource subResource = resource.addNewChildResource("Child", "{test}/test" );
34  		assertEquals( "/{id}/test/{test}/test", subResource.getFullPath() );
35  	}
36  }