commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tobr...@apache.org
Subject cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io/filefilter FileFilterTestCase.java
Date Tue, 25 Feb 2003 09:03:52 GMT
tobrien     2003/02/25 01:03:50

  Modified:    io/src/test/org/apache/commons/io/filefilter
                        FileFilterTestCase.java
  Log:
  fixed FileFilterTestCase, was not running due to a few NPEs and faulty test cases
  
  Revision  Changes    Path
  1.5       +18 -12    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileFilterTestCase.java	27 Jan 2003 02:22:31 -0000	1.4
  +++ FileFilterTestCase.java	25 Feb 2003 09:03:50 -0000	1.5
  @@ -96,11 +96,15 @@
                  (filter.accept(file) == expected) 
                  );
   
  -       if(file.getParentFile() != null) {
  +       if(file != null && file.getParentFile() != null) {
              assertTrue(
                   "Filter(File, String) "+filter.getClass().getName()+" not "+expected+"
for "+file, 
                   (filter.accept(file.getParentFile(), file.getName()) == expected)
              );
  +       } else if( file == null ) {
  +	   assertTrue(
  +		      "Filter(File, String) "+filter.getClass().getName()+" not "+expected+" for null",
  +		      filter.accept( file ) == expected );
          }
       }
   
  @@ -118,13 +122,15 @@
   
       public void testDirectory() throws Exception {
           FileFilter filter = new DirectoryFileFilter();
  -        /* These don't like the test for accept(File, String)
  +
           assertFiltering( filter, new File("src/"), true);
           assertFiltering( filter, new File("src/java/"), true);
  -        */
  +        
           assertFiltering( filter, new File("project.xml"), false);
  -        assertFiltering( filter, new File("test"), false);
  -        assertFiltering( filter, new File("test/"), false);
  +	
  +	assertFiltering( filter, new File("test"), true);
  +        assertFiltering( filter, new File("test/"), true);
  +
           assertFiltering( filter, new File("STATUS.html"), false);
       }
   
  @@ -132,7 +138,7 @@
           FileFilter filter = new PrefixFileFilter( new String[] { "foo", "bar" } );
           assertFiltering( filter, new File("foo.test"), true);
           assertFiltering( filter, new File("foo"), true);
  -        assertFiltering( filter, new File("bar"), false);
  +        assertFiltering( filter, new File("bar"), true);
           assertFiltering( filter, new File("food/"), true);
           assertFiltering( filter, new File("barred\\"), true);
           assertFiltering( filter, new File("test"), false);
  @@ -142,9 +148,9 @@
   
       public void testNull() throws Exception {
           FileFilter filter = FileFilterUtils.nullFileFilter();
  -        assertFiltering( filter, new File("foo.test"), true);
  -        assertFiltering( filter, new File("foo"), true);
  -        assertFiltering( filter, new File(""), true);
  +        assertFiltering( filter, new File("foo.test"), false);
  +        assertFiltering( filter, new File("foo"), false);
  +        assertFiltering( filter, null, true);
       }
   
   }
  
  
  

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