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 IdentifierUtilsTest.java
Date Mon, 31 May 2004 07:16:13 GMT
treilly     2004/05/31 00:16:13

  Modified:    id/src/test/org/apache/commons/id IdentifierUtilsTest.java
  Log:
  added comments, whitespace reformats
  
  Revision  Changes    Path
  1.4       +28 -17    jakarta-commons-sandbox/id/src/test/org/apache/commons/id/IdentifierUtilsTest.java
  
  Index: IdentifierUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/id/src/test/org/apache/commons/id/IdentifierUtilsTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IdentifierUtilsTest.java	29 Feb 2004 16:06:33 -0000	1.3
  +++ IdentifierUtilsTest.java	31 May 2004 07:16:13 -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.
  @@ -30,25 +30,23 @@
    */
   public class IdentifierUtilsTest extends junit.framework.TestCase {
   
  -    /**
  -     * Construct
  -     */
  +    /** Constructor @param name String test name. */
       public IdentifierUtilsTest(String name) {
           super(name);
       }
   
  -    /**
  -     * Return class aa a test suite.
  -     */
  +    /** @see junit.framework.TestSuite#suite() */
       public static Test suite() {
           TestSuite suite = new TestSuite(IdentifierUtilsTest.class);
           suite.setName("IdentifierUtils Tests");
           return suite;
       }
  -    
  +
  +    /** Factory instance */
       protected static IdentifierGeneratorFactory factory = IdentifierGeneratorFactory.newInstance();
   
       //-----------------------------------------------------------------------
  +    /** Test the constructors */
       public void testConstructor() {
           assertNotNull(new IdentifierUtils());
           Constructor[] cons = IdentifierUtils.class.getDeclaredConstructors();
  @@ -57,9 +55,10 @@
           assertEquals(true, Modifier.isPublic(IdentifierUtils.class.getModifiers()));
           assertEquals(false, Modifier.isFinal(IdentifierUtils.class.getModifiers()));
       }
  -    
  +
       //--------------------------------------------------------------------------
   
  +    /** Test LongIdentifier incrementing */
       public void testLongIncrementing() {
           LongIdentifierGenerator f = IdentifierUtils.LONG_IDENTIFIER_GENERATOR;
           assertEquals(new Long(0), f.nextLongIdentifier());
  @@ -72,6 +71,7 @@
           assertEquals(new Long(7), IdentifierUtils.nextLongIdentifier());
       }
   
  +    /** Test LongIdentifier incrementing with no arg */
       public void testLongIncrementingNoArgs() {
           LongIdentifierGenerator f = factory.longGenerator();
           assertEquals(new Long(0), f.nextLongIdentifier());
  @@ -79,12 +79,14 @@
           assertTrue(f != IdentifierUtils.LONG_IDENTIFIER_GENERATOR);
       }
   
  +    /** Test LongIdentifier initialization */
       public void testLongIncrementingInit() {
           LongIdentifierGenerator f = factory.longGenerator(true, 100);
           assertEquals(new Long(100), f.nextLongIdentifier());
           assertEquals(new Long(101), f.nextLongIdentifier());
       }
   
  +    /** Test LongIdentifier wrapping */
       public void testLongIncrementingWrap() {
           LongIdentifierGenerator f = factory.longGenerator(true, Long.MAX_VALUE - 1);
           assertEquals(new Long(Long.MAX_VALUE - 1), f.nextLongIdentifier());
  @@ -92,6 +94,7 @@
           assertEquals(new Long(Long.MIN_VALUE), f.nextLongIdentifier());
       }
   
  +    /** Test LongIdentifier without wrapping */
       public void testLongIncrementingNoWrap() {
           LongIdentifierGenerator f = factory.longGenerator(false, Long.MAX_VALUE);
           try {
  @@ -101,7 +104,7 @@
       }
   
       //--------------------------------------------------------------------------
  -
  +    /** Test String Numeric identifier */
       public void testStringNumericLong() {
           StringIdentifierGenerator f = IdentifierUtils.STRING_NUMERIC_IDENTIFIER_GENERATOR;
           assertEquals("0", f.nextStringIdentifier());
  @@ -114,6 +117,7 @@
           assertEquals("7", IdentifierUtils.nextStringNumericIdentifier());
       }
   
  +    /** Test String Numeric identifier no argument */
       public void testStringNumericNoArgs() {
           StringIdentifierGenerator f = factory.numericGenerator();
           assertEquals("0", f.nextStringIdentifier());
  @@ -121,12 +125,14 @@
           assertTrue(f != IdentifierUtils.STRING_NUMERIC_IDENTIFIER_GENERATOR);
       }
   
  +    /** Test String Numeric identifier initialization */
       public void testStringNumericInit() {
           StringIdentifierGenerator f = factory.numericGenerator(true, 100);
           assertEquals("100", f.nextStringIdentifier());
           assertEquals("101", f.nextStringIdentifier());
       }
   
  +    /** Test String Numeric identifier wrapping */
       public void testStringNumericWrap() {
           StringIdentifierGenerator f = factory.numericGenerator(true, Long.MAX_VALUE - 1);
           assertEquals(Long.toString(Long.MAX_VALUE - 1), f.nextStringIdentifier());
  @@ -134,6 +140,7 @@
           assertEquals(Long.toString(Long.MIN_VALUE), f.nextStringIdentifier());
       }
   
  +    /** Test String Numeric identifier without wrapping */
       public void testStringNumericNoWrap() {
           StringIdentifierGenerator f = factory.numericGenerator(false, Long.MAX_VALUE);
           try {
  @@ -143,7 +150,7 @@
       }
   
       //--------------------------------------------------------------------------
  -
  +    /** Test String AlphaNumeric identifier */
       public void testStringAlphanumeric() {
           StringIdentifierGenerator f = IdentifierUtils.STRING_ALPHANUMERIC_IDENTIFIER_GENERATOR;
           assertEquals("000000000000001", f.nextStringIdentifier());
  @@ -187,6 +194,7 @@
           assertEquals("000000000000013", f.nextStringIdentifier());
       }
   
  +    /** Test String Numeric identifier no argument */
       public void testLongAlphanumericNoArgs() {
           StringIdentifierGenerator f = factory.alphanumericGenerator();
           assertEquals("000000000000001", f.nextStringIdentifier());
  @@ -194,6 +202,7 @@
           assertTrue(f != IdentifierUtils.STRING_ALPHANUMERIC_IDENTIFIER_GENERATOR);
       }
   
  +    /** Test String Numeric identifier wrapping */
       public void testStringAlphanumericWrap() {
           try {
               StringIdentifierGenerator f = factory.alphanumericGenerator(true, -1);
  @@ -239,12 +248,13 @@
           assertEquals("0", f.nextStringIdentifier());
       }
   
  +    /** Test String Numeric identifier with no wrapping */
       public void testStringAlphanumericNoWrap() {
           try {
               StringIdentifierGenerator f = factory.alphanumericGenerator(false, -1);
               fail();
           } catch (IllegalArgumentException ex) {}
  -        
  +
           StringIdentifierGenerator f = factory.alphanumericGenerator(false, 1);
           assertEquals("1", f.nextStringIdentifier());
           assertEquals("2", f.nextStringIdentifier());
  @@ -289,10 +299,11 @@
   
       //--------------------------------------------------------------------------
   
  +    /** Test String Session identifier */
       public void testStringSession() {
           StringIdentifierGenerator f = factory.sessionIdGenerator();
           assertTrue(f != IdentifierUtils.STRING_SESSION_IDENTIFIER_GENERATOR);
  -        
  +
           String a = (String) f.nextStringIdentifier();
           String b = (String) IdentifierUtils.nextStringSessionIdentifier();
           String c = (String) f.nextIdentifier();
  @@ -313,7 +324,7 @@
           }
           assertEquals("0", a.substring(9));
           assertEquals("0", b.substring(9)); //Different from [lang], factory is independent
  -        assertEquals("1", c.substring(9)); // "" "" 
  +        assertEquals("1", c.substring(9)); // "" ""
       }
       //--------------------------------------------------------------------------
   
  
  
  

---------------------------------------------------------------------
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