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

http://jira.springframework.org/browse/BATCH-779

Updated FieldSetMapper interface method to mapFieldSet from simply map, in order to be more consistent with other *Mapper implementations.
This commit is contained in:
lucasward
2008-10-09 21:20:31 +00:00
parent f1ed1187df
commit 5d4e279850
15 changed files with 36 additions and 36 deletions

View File

@@ -17,26 +17,26 @@ public class AggregateItemFieldSetMapperTests {
@Test
public void testDefaultBeginRecord() throws Exception {
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "BEGIN" })).isHeader());
assertFalse(mapper.map(new DefaultFieldSet(new String[] { "BEGIN" })).isFooter());
assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "BEGIN" })).isHeader());
assertFalse(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "BEGIN" })).isFooter());
}
@Test
public void testSetBeginRecord() throws Exception {
mapper.setBegin("FOO");
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "FOO" })).isHeader());
assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "FOO" })).isHeader());
}
@Test
public void testDefaultEndRecord() throws Exception {
assertFalse(mapper.map(new DefaultFieldSet(new String[] { "END" })).isHeader());
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "END" })).isFooter());
assertFalse(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "END" })).isHeader());
assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "END" })).isFooter());
}
@Test
public void testSetEndRecord() throws Exception {
mapper.setEnd("FOO");
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "FOO" })).isFooter());
assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] { "FOO" })).isFooter());
}
@Test
@@ -53,11 +53,11 @@ public class AggregateItemFieldSetMapperTests {
@Test
public void testDelegate() throws Exception {
mapper.setDelegate(new FieldSetMapper<String>() {
public String map(FieldSet fs) {
public String mapFieldSet(FieldSet fs) {
return "foo";
}
});
assertEquals("foo", mapper.map(new DefaultFieldSet(new String[] { "FOO" })).getItem());
assertEquals("foo", mapper.mapFieldSet(new DefaultFieldSet(new String[] { "FOO" })).getItem());
}

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.map(headerFS)).andReturn(order);
expect(mapper.map(customerFS)).andReturn(customer);
expect(mapper.map(billingFS)).andReturn(billing);
expect(mapper.map(shippingFS)).andReturn(shipping);
expect(mapper.map(billingInfoFS)).andReturn(billingInfo);
expect(mapper.map(shippingInfoFS)).andReturn(shippingInfo);
expect(mapper.map(itemFS)).andReturn(item).times(3);
expect(mapper.mapFieldSet(headerFS)).andReturn(order);
expect(mapper.mapFieldSet(customerFS)).andReturn(customer);
expect(mapper.mapFieldSet(billingFS)).andReturn(billing);
expect(mapper.mapFieldSet(shippingFS)).andReturn(shipping);
expect(mapper.mapFieldSet(billingInfoFS)).andReturn(billingInfo);
expect(mapper.mapFieldSet(shippingInfoFS)).andReturn(shippingInfo);
expect(mapper.mapFieldSet(itemFS)).andReturn(item).times(3);
replay(mapper);
// set-up provider: set mappers

View File

@@ -38,7 +38,7 @@ public abstract class AbstractFieldSetMapperTests {
*/
@Test
public void testRegularUse() throws Exception {
assertEquals(expectedDomainObject(), fieldSetMapper().map(fieldSet()));
assertEquals(expectedDomainObject(), fieldSetMapper().mapFieldSet(fieldSet()));
}
}