org.springframework.batch.item
Class CommonItemReaderTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.batch.item.CommonItemReaderTests
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CommonItemStreamItemReaderTests

public abstract class CommonItemReaderTests
extends junit.framework.TestCase

Common tests for ItemReader implementations. Expected input is five Foo objects with values 1 to 5.


Field Summary
protected  ItemReader tested
           
 
Constructor Summary
CommonItemReaderTests()
           
 
Method Summary
protected abstract  ItemReader getItemReader()
           
protected abstract  void pointToEmptyInput(ItemReader tested)
          Point the reader to empty input (close and open if necessary for the new settings to apply).
protected  void setUp()
           
 void testEmptyInput()
          Empty input should be handled gracefully - null is returned on first read.
 void testRead()
          Regular scenario - read the input and eventually return null.
 void testReset()
          Rollback scenario - reader resets to last marked point.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tested

protected ItemReader tested
Constructor Detail

CommonItemReaderTests

public CommonItemReaderTests()
Method Detail

getItemReader

protected abstract ItemReader getItemReader()
                                     throws Exception
Returns:
configured ItemReader ready for use.
Throws:
Exception

setUp

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

testRead

public void testRead()
              throws Exception
Regular scenario - read the input and eventually return null.

Throws:
Exception

testReset

public void testReset()
               throws Exception
Rollback scenario - reader resets to last marked point. Note the commit interval can change dynamically.

Throws:
Exception

testEmptyInput

public void testEmptyInput()
                    throws Exception
Empty input should be handled gracefully - null is returned on first read.

Throws:
Exception

pointToEmptyInput

protected abstract void pointToEmptyInput(ItemReader tested)
                                   throws Exception
Point the reader to empty input (close and open if necessary for the new settings to apply).

Parameters:
tested - the reader
Throws:
Exception


Copyright © 2008 SpringSource. All Rights Reserved.