commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roxspr...@apache.org
Subject cvs commit: jakarta-commons/cli/src/test/org/apache/commons/cli2/util ComparatorsTest.java
Date Tue, 20 Apr 2004 22:19:53 GMT
roxspring    2004/04/20 15:19:53

  Modified:    cli/src/test/org/apache/commons/cli2/util Tag:
                        RESEARCH_CLI_2_ROXSPRING ComparatorsTest.java
  Log:
  Added test for chained comparators
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.4   +18 -0     jakarta-commons/cli/src/test/org/apache/commons/cli2/util/Attic/ComparatorsTest.java
  
  Index: ComparatorsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli2/util/Attic/ComparatorsTest.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ComparatorsTest.java	20 Apr 2004 21:48:59 -0000	1.1.2.3
  +++ ComparatorsTest.java	20 Apr 2004 22:19:53 -0000	1.1.2.4
  @@ -16,6 +16,7 @@
   package org.apache.commons.cli2.util;
   
   import java.util.Collections;
  +import java.util.Comparator;
   import java.util.List;
   
   import junit.framework.TestCase;
  @@ -199,6 +200,23 @@
   
           OptionTestCase.assertListContentsEqual(
               OptionTestCase.list(o1, o2),
  +            list);
  +    }
  +    
  +    public void testChained() {
  +        final Option o1 = CommandTest.buildCommitCommand();
  +        final Option o2 = SwitchTest.buildDisplaySwitch();
  +        final Option o3 = DefaultOptionTest.buildHelpOption();
  +        final List list = OptionTestCase.list(o1, o2, o3);
  +        
  +        Collections.sort(
  +            list, 
  +            Comparators.chain(
  +                Comparators.namedFirst("--help"),
  +                Comparators.commandFirst()));
  +
  +        OptionTestCase.assertListContentsEqual(
  +            OptionTestCase.list(o3, o1, o2),
               list);
       }
   }
  
  
  

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