RESOLVED - BATCH-779: make FieldSetMapper and LineAggregator extend ItemProcessor

FiedSetMapper, LineTokenizer and LineAggregator interfaces now extend ItemProcessor
This commit is contained in:
robokaso
2008-09-29 11:36:13 +00:00
parent 131b524dcb
commit a6fd1cecc0
47 changed files with 186 additions and 196 deletions

View File

@@ -84,13 +84,13 @@ public class OrderItemReaderTests {
// create mock mapper
FieldSetMapper mapper = createMock(FieldSetMapper.class);
// set how mapper should respond - set return values for mapper
expect(mapper.mapLine(headerFS)).andReturn(order);
expect(mapper.mapLine(customerFS)).andReturn(customer);
expect(mapper.mapLine(billingFS)).andReturn(billing);
expect(mapper.mapLine(shippingFS)).andReturn(shipping);
expect(mapper.mapLine(billingInfoFS)).andReturn(billingInfo);
expect(mapper.mapLine(shippingInfoFS)).andReturn(shippingInfo);
expect(mapper.mapLine(itemFS)).andReturn(item).times(3);
expect(mapper.process(headerFS)).andReturn(order);
expect(mapper.process(customerFS)).andReturn(customer);
expect(mapper.process(billingFS)).andReturn(billing);
expect(mapper.process(shippingFS)).andReturn(shipping);
expect(mapper.process(billingInfoFS)).andReturn(billingInfo);
expect(mapper.process(shippingInfoFS)).andReturn(shippingInfo);
expect(mapper.process(itemFS)).andReturn(item).times(3);
replay(mapper);
// set-up provider: set mappers

View File

@@ -33,46 +33,46 @@ public class CompositeCustomerUpdateLineTokenizerTests {
}
@Test
public void testFooter(){
public void testFooter() throws Exception{
String footerLine = "Ffjkdalsfjdaskl;f";
FieldSet fs = compositeTokenizer.tokenize(footerLine);
FieldSet fs = compositeTokenizer.process(footerLine);
assertEquals(footerFieldSet, fs);
assertEquals(footerLine, footerTokenizer.getTokenizedLine());
}
@Test
public void testCustomerAdd(){
public void testCustomerAdd() throws Exception{
String customerAddLine = "AFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
FieldSet fs = compositeTokenizer.process(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@Test
public void testCustomerDelete(){
public void testCustomerDelete() throws Exception{
String customerAddLine = "DFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
FieldSet fs = compositeTokenizer.process(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@Test
public void testCustomerUpdate(){
public void testCustomerUpdate() throws Exception{
String customerAddLine = "UFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
FieldSet fs = compositeTokenizer.process(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@Test(expected=IllegalArgumentException.class)
public void testInvalidLine(){
public void testInvalidLine() throws Exception{
String invalidLine = "INVALID";
compositeTokenizer.tokenize(invalidLine);
compositeTokenizer.process(invalidLine);
}
@@ -85,7 +85,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
this.fieldSetToReturn = fieldSetToReturn;
}
public FieldSet tokenize(String line) {
public FieldSet process(String line) {
this.tokenizedLine = line;
return fieldSetToReturn;
}

View File

@@ -34,10 +34,11 @@ public abstract class AbstractFieldSetMapperTests {
/**
* Regular usage scenario.
* Assumes the domain object implements sensible <code>equals(Object other)</code>
* @throws Exception
*/
@Test
public void testRegularUse() {
assertEquals(expectedDomainObject(), fieldSetMapper().mapLine(fieldSet()));
public void testRegularUse() throws Exception {
assertEquals(expectedDomainObject(), fieldSetMapper().process(fieldSet()));
}
}