1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.businessobjects.environment;
16  
17  import org.figure8.join.businessobjects.commons.Target;
18  
19  import junit.framework.Test;
20  import junit.framework.TestCase;
21  import junit.framework.TestSuite;
22  /**
23   * JUnit test case for testing ParameterValue business object.
24   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
25   * @version $Revision: 1.2 $
26   */
27  public class ParameterValueTest extends TestCase{
28  
29     // Constructors -------------------------------------------------------------
30  
31     /** Default constructor. Build a test case using a name. */
32     public ParameterValueTest(String testName){
33        super(testName);
34     }
35  
36  
37     // Attributes ---------------------------------------------------------------
38  
39     /** The ParameterValue to test. */
40     protected ParameterValue value = null;
41  
42  
43     // Override of TestCase -----------------------------------------------------
44  
45     /**
46      * Make this class a TestSuite.
47      * @return A TestSuite containing this TestCase.
48      */
49     public static Test suite(){
50        TestSuite suite = new TestSuite(ParameterValueTest.class);
51        return suite;
52     }
53     
54     
55     // Public -------------------------------------------------------------------
56  
57     /** Set up the test fixture. */
58     public void setUp(){
59        // Create the objects we need.
60        Target target = new Target("target", "description");
61        Parameter param = new Parameter("param", "description");
62        PhysicalEnvironment env = new PhysicalEnvironment("env", "Env Name");
63        // Create the parameter value to test.
64        value = new ParameterValue("value", param, target, env);
65     }
66  
67     /** Test the deprecation of a value. */
68     public void testDeprecation(){
69        // Assert before deprecate.
70        assertNull("No deprecation date", value.getDeprecationDate());
71        assertEquals("Current value", ParameterValue.CURRENT, value.getStatus());
72        // Deprecate and assert.
73        value.deprecate();
74        assertNotNull("A deprecation date", value.getDeprecationDate());
75        assertEquals("Historical value", ParameterValue.HISTORICAL, value.getStatus());
76     }
77  }