Package: com.ibm.jbatch.tck.tests.jslxml
Class: ListenerOnErrorTests

testOnWriteErrorItems

Test introduced in TCK Version: 1.1.WORKING

Test Assertion(s)

Assertion(s)
ItemWriteListener#onWriteError is passed the list of items that were being written by ItemWriter#writeItems when exception was thrown.

Jakarta Batch Reference(s)

Section Version Citation(s) Note(s)
9.1.1.3 1.0 ~ @param items specifies the list of items to write. This may be an empty list (e.g. if all the items have been filtered out by the ItemProcessor). ~ API for ItemWriter
9.2.6 1.0 ~ The onWriteError method receives control after an item writer writeItems throws an exception. The method receives the list of items sent to the item writer as input. ~ API for ItemWriteListener

API Reference(s)

Class Name Method Names Note(s)
jakarta.batch.api.chunk.ItemWriter ~ writeItems
jakarta.batch.api.chunk.listener.ItemWriteListener ~ onWriteError

Issue Reference(s)

Link(s)
https://java.net/bugzilla/show_bug.cgi?id=5431

Test Strategy

Strategy
Intentionally fail writer at a specific record number. Take the items passed as input parameter to onWriteError, and set a String representation of this List as the job's exit status. Check that this matches the expected value based on the chunk size, input data, and failing record number. Also check that the job fails.

Additional Comments

Comment(s)