commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter FileFilterTestCase.java
Date Sat, 22 Nov 2003 20:08:23 GMT
jeremias    2003/11/22 12:08:23

  Modified:    io/src/test/org/apache/commons/io/filefilter
                        FileFilterTestCase.java
  Log:
  More tests (especially the bug I just fixed in PrefixFileFilter and the new NameFileFilter)
  
  Revision  Changes    Path
  1.11      +26 -2     jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
  
  Index: FileFilterTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FileFilterTestCase.java	13 Oct 2003 07:05:43 -0000	1.10
  +++ FileFilterTestCase.java	22 Nov 2003 20:08:23 -0000	1.11
  @@ -104,12 +104,16 @@
           IOFileFilter filter = new SuffixFileFilter(new String[] { "tes", "est" });
           assertFiltering(filter, new File("fred.tes"), true);
           assertFiltering(filter, new File("fred.est"), true);
  +        assertFiltering(filter, new File("fred.EST"), false); //case-sensitive
           assertFiltering(filter, new File("fred.exe"), false);
           assertFiltering(filter, new File("fred"), false);
  -
  -        // SHOULD THESE WORK???
           assertFiltering(filter, new File(".tes"), true);
           assertFiltering(filter, new File("fred.test"), true);
  +        
  +        filter = new SuffixFileFilter("est");
  +        assertFiltering(filter, new File("test"), true);
  +        assertFiltering(filter, new File("fred"), false);
  +        
           try {
               new SuffixFileFilter((String) null);
               fail();
  @@ -134,6 +138,7 @@
       public void testPrefix() throws Exception {
           IOFileFilter filter = new PrefixFileFilter(new String[] { "foo", "bar" });
           assertFiltering(filter, new File("foo.test"), true);
  +        assertFiltering(filter, new File("FOO.test"), false);  //case-sensitive
           assertFiltering(filter, new File("foo"), true);
           assertFiltering(filter, new File("bar"), true);
           assertFiltering(filter, new File("food/"), true);
  @@ -141,11 +146,30 @@
           assertFiltering(filter, new File("test"), false);
           assertFiltering(filter, new File("fo_o.test"), false);
           assertFiltering(filter, new File("abar.exe"), false);
  +        
  +        filter = new PrefixFileFilter("tes");
  +        assertFiltering(filter, new File("test"), true);
  +        assertFiltering(filter, new File("fred"), false);
  +        
           try {
               new PrefixFileFilter((String) null);
               fail();
           } catch (IllegalArgumentException ex) {
           }
  +    }
  +    
  +    public void testNameFilter() throws Exception {
  +        IOFileFilter filter = new NameFileFilter(new String[] { "foo", "bar" });
  +        assertFiltering(filter, new File("foo"), true);
  +        assertFiltering(filter, new File("bar"), true);
  +        assertFiltering(filter, new File("fred"), false);
  +
  +        filter = new NameFileFilter("foo");
  +        assertFiltering(filter, new File("foo"), true);
  +        assertFiltering(filter, new File("FOO"), false); //case-sensitive
  +        assertFiltering(filter, new File("barfoo"), false);
  +        assertFiltering(filter, new File("foobar"), false);
  +        assertFiltering(filter, new File("fred"), false);
       }
   
       public void testTrue() throws Exception {
  
  
  

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