FileDocCategorySizeDatePackage
CompositeFTPParseTestFramework.javaAPI DocApache Commons NET 1.4.1 API4195Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.ftp.parser

CompositeFTPParseTestFramework

public abstract class CompositeFTPParseTestFramework extends FTPParseTestFramework
author
MarioIvankovits
version
$Id: CompositeFTPParseTestFramework.java 155429 2005-02-26 13:13:04Z dirkv $

Fields Summary
Constructors Summary
public CompositeFTPParseTestFramework(String name)

see
junit.framework.TestCase#TestCase(String)

        super(name);
    
Methods Summary
protected java.lang.String[]getBadListing()

see
FTPParseTestFramework#getBadListing()

        return (getBadListings()[0]);
    
protected abstract java.lang.String[][]getBadListings()
Method getBadListing. Implementors must provide multiple listing that contains failures and must force the composite parser to switch the FtpEntryParser

return
String[]

protected java.lang.String[]getGoodListing()

see
FTPParseTestFramework#getGoodListing()

        return (getGoodListings()[0]);
    
protected abstract java.lang.String[][]getGoodListings()
Method getGoodListing. Implementors must provide multiple listing that passes and must force the composite parser to switch the FtpEntryParser

return
String[]

public voidtestBadListing()

        String badsamples[][] = getBadListings();

        for (int i = 0; i < badsamples.length; i++)
        {
            FTPFileEntryParser parser = getParser();
            for (int j = 0; j < badsamples[i].length; j++)
            {
                String test = badsamples[i][j];
                FTPFile f = parser.parseFTPEntry(test);
                assertNull("Should have Failed to parse " + test,
                        f);

                doAdditionalBadTests(test, f);
            }
        }
    
public voidtestConsistentListing()

        String goodsamples[][] = getGoodListings();

        for (int i = 0; i < goodsamples.length; i++)
        {
            FTPFileEntryParser parser = getParser();
            for (int j = 0; j < goodsamples[i].length; j++)
            {
                String test = goodsamples[i][j];
                FTPFile f = parser.parseFTPEntry(test);
                assertNotNull("Failed to parse " + test,
                        f);

                doAdditionalGoodTests(test, f);
            }
        }
    
public voidtestInconsistentListing()

        String goodsamples[][] = getGoodListings();

        FTPFileEntryParser parser = getParser();

        for (int i = 0; i < goodsamples.length; i++)
        {
            String test = goodsamples[i][0];
            FTPFile f = parser.parseFTPEntry(test);

            switch (i)
            {
            case 0:
                assertNotNull("Failed to parse " + test, f);
                break;
            case 1:
                assertNull("Should have failed to parse " + test, f);
                break;
            }
        }