commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trei...@apache.org
Subject cvs commit: jakarta-commons-sandbox/id/src/test/org/apache/commons/id IdentifierGeneratorFactoryTest.java
Date Mon, 31 May 2004 07:16:01 GMT
treilly     2004/05/31 00:16:01

  Modified:    id/src/test/org/apache/commons/id
                        IdentifierGeneratorFactoryTest.java
  Log:
  added comments, whitespace reformats
  
  Revision  Changes    Path
  1.4       +27 -23    jakarta-commons-sandbox/id/src/test/org/apache/commons/id/IdentifierGeneratorFactoryTest.java
  
  Index: IdentifierGeneratorFactoryTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/id/src/test/org/apache/commons/id/IdentifierGeneratorFactoryTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IdentifierGeneratorFactoryTest.java	29 Feb 2004 16:06:33 -0000	1.3
  +++ IdentifierGeneratorFactoryTest.java	31 May 2004 07:16:01 -0000	1.4
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2003-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -22,61 +22,65 @@
   
   /**
    * Unit tests for {@link IdentifierGeneratorFactory}.
  - *  
  + *
    * @version $Revision$ $Date$
    * @author Commons-Uid team
    */
   public class IdentifierGeneratorFactoryTest extends TestCase {
  -        
  +
  +    /** Constructor @param name String of the test. */
       public IdentifierGeneratorFactoryTest(String name) {
           super(name);
       }
   
  +    /** Main application entry @param args String array of argument. */
       public static void main(String[] args) {
           TestRunner.run(suite());
       }
  - 
  +
  +    /** @see junit.framework.TestSuite#suite() */
       public static Test suite() {
  -    	TestSuite suite = new TestSuite(IdentifierGeneratorFactoryTest.class);
  -    	suite.setName("IdentifierGeneratorFactory Tests");
  +        TestSuite suite = new TestSuite(IdentifierGeneratorFactoryTest.class);
  +        suite.setName("IdentifierGeneratorFactory Tests");
           return suite;
       }
  -    
  +
       //-------------------------------------------------------------------------
  -    
  +    /** @see junit.framework.TestSuite#setUp() */
       protected void setUp() throws Exception {
           super.setUp();
       }
  -    
  +
       /**
        * Test disovery for custom factories based on system property
  +     * @throws Exception a testing Exception.
        */
       public void testDiscovery() throws Exception {
  -        
  +
           // Override System property with Custom factory class name
  -        System.setProperty(IdentifierGeneratorFactory.class.getName(), 
  +        System.setProperty(IdentifierGeneratorFactory.class.getName(),
               "org.apache.commons.id.CustomIdentifierGeneratorFactory");
  -        
  +
           // Custom factory creates default LongGenerator that starts with 100 instead of
1.
           IdentifierGeneratorFactory factory = IdentifierGeneratorFactory.newInstance();
           LongIdentifierGenerator longGenerator = factory.longGenerator();
           assertEquals(new Long(100), longGenerator.nextLongIdentifier());
  -        
  +
           // Now reset back to default -- should start with 1 now.
  -        System.setProperty(IdentifierGeneratorFactory.class.getName(), 
  +        System.setProperty(IdentifierGeneratorFactory.class.getName(),
               "org.apache.commons.id.DefaultIdentifierGeneratorFactory");
           factory = IdentifierGeneratorFactory.newInstance();
           longGenerator = factory.longGenerator();
           assertEquals(new Long(0), longGenerator.nextLongIdentifier());
  -        
  +
           // Now blow things up with a bad class def, factory will (quietly) be null
  -        System.setProperty(IdentifierGeneratorFactory.class.getName(), 
  +        System.setProperty(IdentifierGeneratorFactory.class.getName(),
               "BadClassName");
           factory = IdentifierGeneratorFactory.newInstance();
           assertNull(factory);
  -        
  +
           // Better fix now, so later tests don't blow up
  -        System.setProperty(IdentifierGeneratorFactory.class.getName(), 
  -            "org.apache.commons.id.DefaultIdentifierGeneratorFactory");   
  -    }        
  +        System.setProperty(IdentifierGeneratorFactory.class.getName(),
  +            "org.apache.commons.id.DefaultIdentifierGeneratorFactory");
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message