commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl CollectionResourcesBaseTestCase.java PropertyResourcesTestCase.java XMLResourcesTestCase.java
Date Mon, 08 Sep 2003 18:14:56 GMT
rdonkin     2003/09/08 11:14:56

  Modified:    resources/src/test/org/apache/commons/resources/impl
                        CollectionResourcesBaseTestCase.java
                        PropertyResourcesTestCase.java
                        XMLResourcesTestCase.java
  Log:
  Refactored tests (so that i could work out what was going wrong.
  
  Revision  Changes    Path
  1.5       +9 -6      jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java
  
  Index: CollectionResourcesBaseTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CollectionResourcesBaseTestCase.java	28 Feb 2003 02:54:50 -0000	1.4
  +++ CollectionResourcesBaseTestCase.java	8 Sep 2003 18:14:56 -0000	1.5
  @@ -91,7 +91,7 @@
   
   
       // Base URL of the resource files for the Resources instance to be created
  -    protected static final String BASE = "fixme";
  +    private static final String BASE = "fixme";
   
   
       // ----------------------------------------------------------- Constructors
  @@ -108,7 +108,7 @@
       // Set up instance variables required by this test case
       public void setUp() throws Exception {
           factory = new CollResourcesFactory();
  -        resources = factory.getResources(NAME, BASE);
  +        resources = factory.getResources(NAME, getBase());
       }
   
       // Return the tests included in this test suite
  @@ -122,6 +122,9 @@
           factory = null;
       }
   
  +    protected String getBase() throws Exception {
  +        return BASE;
  +    }
   
       // ------------------------------------------------ Individual Test Methods
   
  
  
  
  1.3       +15 -11    jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/PropertyResourcesTestCase.java
  
  Index: PropertyResourcesTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/PropertyResourcesTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyResourcesTestCase.java	28 Feb 2003 02:54:50 -0000	1.2
  +++ PropertyResourcesTestCase.java	8 Sep 2003 18:14:56 -0000	1.3
  @@ -86,17 +86,21 @@
       // ----------------------------------------------------- Instance Variables
   
   
  -    // Base URL of the resource files for the Resources instance to be created
  -    protected static String BASE = null;
  -    static {
  -        URL url =
  +
  +    protected String getBase() throws Exception
  +    {
  +        URL url = 
               PropertyResourcesTestCase.class.getResource
               ("/org/apache/commons/resources/impl/TestResources.properties");
  +    
  +        if (url == null) {
  +            fail("URL NOT FOUND");
  +        }
           String string = url.toExternalForm();
  -        BASE = string.substring(0, string.length() - 11);
  +        String base = string.substring(0, string.length() - 11);
  +        return base;
       }
   
  -
       // ----------------------------------------------------------- Constructors
   
   
  @@ -111,7 +115,7 @@
       // Set up instance variables required by this test case
       public void setUp() throws Exception {
           factory = new PropertyResourcesFactory();
  -        resources = factory.getResources(NAME, BASE);
  +        resources = factory.getResources(NAME, getBase());
       }
   
       // Return the tests included in this test suite
  
  
  
  1.3       +16 -16    jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/XMLResourcesTestCase.java
  
  Index: XMLResourcesTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/impl/XMLResourcesTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLResourcesTestCase.java	28 Feb 2003 02:54:50 -0000	1.2
  +++ XMLResourcesTestCase.java	8 Sep 2003 18:14:56 -0000	1.3
  @@ -86,17 +86,6 @@
       // ----------------------------------------------------- Instance Variables
   
   
  -    // Base URL of the resource files for the Resources instance to be created
  -    protected static String BASE = null;
  -    static {
  -        URL url =
  -            XMLResourcesTestCase.class.getResource
  -            ("/org/apache/commons/resources/impl/TestResources.properties");
  -        String string = url.toExternalForm();
  -        BASE = string.substring(0, string.length() - 11);
  -    }
  -
  -
       // ----------------------------------------------------------- Constructors
   
   
  @@ -111,7 +100,7 @@
       // Set up instance variables required by this test case
       public void setUp() throws Exception {
           factory = new XMLResourcesFactory();
  -        resources = factory.getResources(NAME, BASE);
  +        resources = factory.getResources(NAME, getBase());
       }
   
       // Return the tests included in this test suite
  @@ -123,6 +112,17 @@
       public void tearDown() {
           resources = null;
           factory = null;
  +    }
  +    
  +    protected String getBase() throws Exception{
  +        URL url =
  +            XMLResourcesTestCase.class.getResource
  +            ("/org/apache/commons/resources/impl/TestResources.properties");
  +        if (url == null) {
  +            fail("URL NOT FOUND");
  +        }
  +        String string = url.toExternalForm();
  +        return string.substring(0, string.length() - 11);
       }
   
   
  
  
  

Mime
View raw message