org.apache.commons.fileupload
Class DefaultFileItemTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.fileupload.DefaultFileItemTest
All Implemented Interfaces:
junit.framework.Test

public class DefaultFileItemTest
extends junit.framework.TestCase

Unit tests for DefaultFileItem.

Author:
Martin Cooper

Constructor Summary
DefaultFileItemTest(String name)
          Standard JUnit test case constructor.
 
Method Summary
protected  FileItemFactory createFactory(File repository)
          Creates a new FileItemFactory and returns it, obscuring from the caller the underlying implementation of this interface.
 void doTestAboveThreshold(File repository)
          Common code for cases where the amount of data is above the configured threshold, but the ultimate destination of the data has not yet been determined.
 void testAboveThresholdDefaultRepository()
          Test creation of a field for which the amount of data falls above the configured threshold, where no specific repository is configured.
 void testAboveThresholdSpecifiedRepository()
          Test creation of a field for which the amount of data falls above the configured threshold, where a specific repository is configured.
 void testBelowThreshold()
          Test creation of a field for which the amount of data falls below the configured threshold.
 void testContentCharSet()
          Test construction of content charset.
 void testFileFieldConstruction()
          Test construction of a file field.
 void testTextFieldConstruction()
          Test construction of a regular text field.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultFileItemTest

public DefaultFileItemTest(String name)
Standard JUnit test case constructor.

Parameters:
name - The name of the test case.
Method Detail

testTextFieldConstruction

public void testTextFieldConstruction()
Test construction of a regular text field.


testFileFieldConstruction

public void testFileFieldConstruction()
Test construction of a file field.


testBelowThreshold

public void testBelowThreshold()
Test creation of a field for which the amount of data falls below the configured threshold.


testAboveThresholdDefaultRepository

public void testAboveThresholdDefaultRepository()
Test creation of a field for which the amount of data falls above the configured threshold, where no specific repository is configured.


testAboveThresholdSpecifiedRepository

public void testAboveThresholdSpecifiedRepository()
Test creation of a field for which the amount of data falls above the configured threshold, where a specific repository is configured.


doTestAboveThreshold

public void doTestAboveThreshold(File repository)
Common code for cases where the amount of data is above the configured threshold, but the ultimate destination of the data has not yet been determined.

Parameters:
repository - The directory within which temporary files will be created.

createFactory

protected FileItemFactory createFactory(File repository)
Creates a new FileItemFactory and returns it, obscuring from the caller the underlying implementation of this interface.

Parameters:
repository - The directory within which temporary files will be created.
Returns:
the new FileItemFactory instance.

testContentCharSet

public void testContentCharSet()
                        throws Exception
Test construction of content charset.

Throws:
Exception


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.