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

reverted to original method names
This commit is contained in:
robokaso
2008-10-09 11:16:11 +00:00
parent 81513dbdc6
commit 3acd3228d3
43 changed files with 174 additions and 158 deletions

View File

@@ -17,26 +17,26 @@ public class AggregateItemFieldSetMapperTests {
@Test
public void testDefaultBeginRecord() throws Exception {
assertTrue(mapper.process(new DefaultFieldSet(new String[] { "BEGIN" })).isHeader());
assertFalse(mapper.process(new DefaultFieldSet(new String[] { "BEGIN" })).isFooter());
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "BEGIN" })).isHeader());
assertFalse(mapper.map(new DefaultFieldSet(new String[] { "BEGIN" })).isFooter());
}
@Test
public void testSetBeginRecord() throws Exception {
mapper.setBegin("FOO");
assertTrue(mapper.process(new DefaultFieldSet(new String[] { "FOO" })).isHeader());
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "FOO" })).isHeader());
}
@Test
public void testDefaultEndRecord() throws Exception {
assertFalse(mapper.process(new DefaultFieldSet(new String[] { "END" })).isHeader());
assertTrue(mapper.process(new DefaultFieldSet(new String[] { "END" })).isFooter());
assertFalse(mapper.map(new DefaultFieldSet(new String[] { "END" })).isHeader());
assertTrue(mapper.map(new DefaultFieldSet(new String[] { "END" })).isFooter());
}
@Test
public void testSetEndRecord() throws Exception {
mapper.setEnd("FOO");
assertTrue(mapper.process(new DefaultFieldSet(new String[] { "FOO" })).isFooter());
assertTrue(mapper.map(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 process(FieldSet fs) {
public String map(FieldSet fs) {
return "foo";
}
});
assertEquals("foo", mapper.process(new DefaultFieldSet(new String[] { "FOO" })).getItem());
assertEquals("foo", mapper.map(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.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);
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);
replay(mapper);
// set-up provider: set mappers

View File

@@ -36,7 +36,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
public void testCustomerAdd() throws Exception{
String customerAddLine = "AFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.process(customerAddLine);
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@@ -45,7 +45,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
public void testCustomerDelete() throws Exception{
String customerAddLine = "DFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.process(customerAddLine);
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@@ -54,7 +54,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
public void testCustomerUpdate() throws Exception{
String customerAddLine = "UFDASFDASFDFSA";
FieldSet fs = compositeTokenizer.process(customerAddLine);
FieldSet fs = compositeTokenizer.tokenize(customerAddLine);
assertEquals(customerFieldSet, fs);
assertEquals(customerAddLine, customerTokenizer.getTokenizedLine());
}
@@ -63,7 +63,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
public void testInvalidLine() throws Exception{
String invalidLine = "INVALID";
compositeTokenizer.process(invalidLine);
compositeTokenizer.tokenize(invalidLine);
}
@@ -76,7 +76,7 @@ public class CompositeCustomerUpdateLineTokenizerTests {
this.fieldSetToReturn = fieldSetToReturn;
}
public FieldSet process(String line) {
public FieldSet tokenize(String line) {
this.tokenizedLine = line;
return fieldSetToReturn;
}

View File

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