1   // Copyright 2006-2008, by the California Institute of 
2   // Technology. ALL RIGHTS RESERVED. United States Government 
3   // Sponsorship acknowledged. Any commercial use must be negotiated with 
4   // the Office of Technology Transfer at the California Institute of 
5   // Technology.
6   //
7   // This software may be subject to U.S. export control laws. By 
8   // accepting this software, the user agrees to comply with all 
9   // applicable U.S. export laws and regulations. User has the 
10  // responsibility to obtain export licenses, or other export authority 
11  // as may be required before exporting such information to foreign 
12  // countries or providing access to foreign persons.
13  //
14  // $Id: AliasTest.java 3460 2008-08-07 16:32:16Z pramirez $
15  
16  package gov.nasa.pds.tools.dict;
17  
18  import gov.nasa.pds.tools.label.Identifier;
19  import junit.framework.TestCase;
20  
21  /***
22   * Unit test case for {@link Alias}
23   * @author pramirez
24   * @version $Revision: 3460 $
25   * 
26   */
27  public class AliasTest extends TestCase {
28  	private String identifier = "identifier";
29  	private String context = "context";
30  	
31  	public AliasTest(String name) {
32  		super(name);
33  	}
34  	
35  	public void testCtors() {
36  		Alias alias = new Alias(identifier);
37  		assertFalse(alias.hasContext());
38  		assertEquals(identifier, alias.getIdentifier().toString());
39  		
40  		Identifier ident = new Identifier(identifier);
41  		alias = new Alias(ident);
42  		assertFalse(alias.hasContext());
43  		assertEquals(ident, alias.getIdentifier());
44  		
45  		alias = new Alias(context, identifier);
46  		assertEquals(context, alias.getContext());
47  		assertEquals(identifier, alias.getIdentifier().toString());
48  		
49  		alias = new Alias(context, ident);
50  		assertEquals(context, alias.getContext());
51  		assertEquals(ident, alias.getIdentifier());
52  	}
53  
54  }