dion        2002/06/12 09:39:15

  Modified:    src/test/org/apache/maven/build PropertyResolverTest.java
  Log:
  Allow loading of properties from a file
  
  Revision  Changes    Path
  1.4       +33 -6     
jakarta-turbine-maven/src/test/org/apache/maven/build/PropertyResolverTest.java
  
  Index: PropertyResolverTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/test/org/apache/maven/build/PropertyResolverTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PropertyResolverTest.java 12 Jun 2002 15:38:25 -0000      1.3
  +++ PropertyResolverTest.java 12 Jun 2002 16:39:15 -0000      1.4
  @@ -66,10 +66,14 @@
    */
   public class PropertyResolverTest extends TestCase
   {
  -    
  +    /** the instance being tested */
       PropertyResolver instance;
  +    /** a properties file used for testing */
  +    String propertiesFile1;
       
  -    /** Creates a new instance of the test case 
  +    /**
  +     * Creates a new instance of the test case 
  +     * 
        * @param testName the name of the test
        */
       public PropertyResolverTest(String testName)
  @@ -84,16 +88,27 @@
       public void setUp() throws Exception
       {
           instance = new PropertyResolver();
  +        String baseDir = System.getProperty("basedir");
  +        assertNotNull("The system property basedir was not defined.", baseDir);
  +        String fs = System.getProperty("file.separator");
  +        assertNotNull("The system property file.separator was not defined.", 
  +            fs);
  +        propertiesFile1 = baseDir + fs + "src/test-build/build.properties";
  +
       }
       
  -    /** test that properties can't be found */
  +    /** 
  +     * test that properties can't be found 
  +     */
       public void testNoProperties()
       {
           assertEquals("get property for non-existing one the wrong value",
               "foobar", instance.getProperty("foobar"));
       }
       
  -    /** test simple string properties can be added and retrieved */
  +    /**
  +     * test simple string properties can be added and retrieved
  +     */
       public void testStringProperties()
       {
           String name = "dummyName";
  @@ -105,7 +120,9 @@
               instance.getProperty(name));
       }
       
  -    /** test object properties */
  +    /** 
  +     * test object properties
  +     */
       public void testObjectProperties()
       {
           Object object = "new Object()";
  @@ -136,5 +153,15 @@
           instance.setProperty(name, "12345678901234567890");
           assertEquals("test length not correct after change", "20", 
               instance.getProperty("test.length"));
  +    }
  +    
  +    /** 
  +     * test reading from properties file
  +     */
  +    public void testPropertiesLoad() throws Exception
  +    {
  +        instance.addPropertiesFromFile(propertiesFile1);
  +        assertEquals("didn't get lib.repo", "/home/dion/source/lib.repo",
  +            instance.getProperty("lib.repo"));
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to