scohen      2003/12/29 17:17:04

  Modified:    net/src/test/org/apache/commons/net/ftp/parser
                        VMSFTPEntryParserTest.java
  Log:
  fix testParseFileList() method so as not to expect listing to be in an order
  which the method being tested is not able to ensure.
  
  Revision  Changes    Path
  1.7       +21 -4     
jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java
  
  Index: VMSFTPEntryParserTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/net/src/test/org/apache/commons/net/ftp/parser/VMSFTPEntryParserTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VMSFTPEntryParserTest.java        5 Aug 2003 18:56:42 -0000       1.6
  +++ VMSFTPEntryParserTest.java        30 Dec 2003 01:17:04 -0000      1.7
  @@ -125,9 +125,26 @@
           VMSFTPEntryParser parser = new VMSFTPEntryParser();
           FTPFile[] files = parser.parseFileList(new 
ByteArrayInputStream(fullListing.getBytes()));
           assertEquals(3, files.length);
  -        assertEquals(files[0].getName(), "2-JUN.LIS", files[0].getName());
  -        assertEquals(files[1].getName(), "3-JUN.LIS", files[1].getName());
  -        assertEquals(files[2].getName(), "1-JUN.LIS", files[2].getName());        
  +        assertFileInListing(files, "1-JUN.LIS");
  +        assertFileInListing(files, "2-JUN.LIS");
  +        assertFileInListing(files, "3-JUN.LIS");
  +        assertFileNotInListing(files, "1-JUN.LIS;1");
  +    }
  +
  +    public void assertFileInListing(FTPFile[] listing, String name) {
  +        for (int i = 0; i < listing.length; i++) {
  +            if (name.equals(listing[i].getName())) {
  +                return;
  +            }
  +        }
  +        fail("File " + name + " not found in supplied listing");
  +    }
  +    public void assertFileNotInListing(FTPFile[] listing, String name) {
  +        for (int i = 0; i < listing.length; i++) {
  +            if (name.equals(listing[i].getName())) {
  +                fail("Unexpected File " + name + " found in supplied listing");
  +            }
  +        }
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to