org.apache.commons.net.ftp.parser
Class FTPParseTestFramework

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.net.ftp.parser.FTPParseTestFramework
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CompositeFTPParseTestFramework, EnterpriseUnixFTPEntryParserTest, MacOsPeterFTPEntryParserTest, MVSFTPEntryParserTest, NetwareFTPEntryParserTest, OS2FTPEntryParserTest, UnixFTPEntryParserTest, VMSFTPEntryParserTest

public abstract class FTPParseTestFramework
extends junit.framework.TestCase

Version:
$Id: FTPParseTestFramework.java 1407341 2012-11-09 01:31:00Z ggregory $
Author:
Steve Cohen

Field Summary
protected  SimpleDateFormat df
           
 
Constructor Summary
FTPParseTestFramework(String name)
           
 
Method Summary
protected  void doAdditionalBadTests(String test, FTPFile f)
          during processing you could hook here to do additional tests
protected  void doAdditionalGoodTests(String test, FTPFile f)
          during processing you could hook here to do additional tests
protected abstract  String[] getBadListing()
          Method getBadListing.
protected abstract  String[] getGoodListing()
          Method getGoodListing.
protected abstract  FTPFileEntryParser getParser()
          Method getParser.
protected  FTPFile nullFileOrNullDate(FTPFile f)
          Check if FTPFile entry parsing failed; i.e.
protected  void setUp()
           
 void testBadListing()
          Method testBadListing.
 void testGoodListing()
          Method testGoodListing.
abstract  void testParseFieldsOnDirectory()
          Method testParseFieldsOnDirectory.
abstract  void testParseFieldsOnFile()
          Method testParseFieldsOnFile.
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

df

protected SimpleDateFormat df
Constructor Detail

FTPParseTestFramework

public FTPParseTestFramework(String name)
See Also:
TestCase.TestCase(String)
Method Detail

testBadListing

public void testBadListing()
                    throws Exception
Method testBadListing. Tests that parser provided failures actually fail.

Throws:
Exception

testGoodListing

public void testGoodListing()
                     throws Exception
Method testGoodListing. Test that parser provided listings pass.

Throws:
Exception

doAdditionalGoodTests

protected void doAdditionalGoodTests(String test,
                                     FTPFile f)
during processing you could hook here to do additional tests

Parameters:
test - raw entry
f - parsed entry

doAdditionalBadTests

protected void doAdditionalBadTests(String test,
                                    FTPFile f)
during processing you could hook here to do additional tests

Parameters:
test - raw entry
f - parsed entry

getBadListing

protected abstract String[] getBadListing()
Method getBadListing. Implementors must provide a listing that contains failures.

Returns:
String[]

getGoodListing

protected abstract String[] getGoodListing()
Method getGoodListing. Implementors must provide a listing that passes.

Returns:
String[]

getParser

protected abstract FTPFileEntryParser getParser()
Method getParser. Provide the parser to use for testing.

Returns:
FTPFileEntryParser

testParseFieldsOnDirectory

public abstract void testParseFieldsOnDirectory()
                                         throws Exception
Method testParseFieldsOnDirectory. Provide a test to show that fields on a directory entry are parsed correctly.

Throws:
Exception

testParseFieldsOnFile

public abstract void testParseFieldsOnFile()
                                    throws Exception
Method testParseFieldsOnFile. Provide a test to show that fields on a file entry are parsed correctly.

Throws:
Exception

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception
See Also:
TestCase.setUp()

nullFileOrNullDate

protected FTPFile nullFileOrNullDate(FTPFile f)
Check if FTPFile entry parsing failed; i.e. if entry is null or date is null.

Parameters:
f - FTPFile entry - may be null
Returns:
null if f is null or the date is null


Copyright © 2001-2014 The Apache Software Foundation. All Rights Reserved.