@Test public void test_alphaNumeric() { CobolFieldDefinition fieldDefinition = factory.build(createInfo(CobolFieldType.ALPHA_NUMERIC, "name", "pattern", 0), paddingDescriptor); assertNotNull(fieldDefinition); assertTrue(fieldDefinition instanceof AlphaNumericFieldDefinition); assertEquals("name", fieldDefinition.getName()); assertEquals("PATTERN", fieldDefinition.getPattern()); assertEquals(0, fieldDefinition.getPosition()); assertSame(paddingDescriptor, fieldDefinition.getPaddingDescriptor()); }
public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }
CobolFieldDefinitionFactory implements FieldDefinitionFactory { public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); } }
CobolFieldDefinitionFactory implements FieldDefinitionFactory { public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }  }
CobolFieldDefinitionFactory implements FieldDefinitionFactory { public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }  CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor); }
CobolFieldDefinitionFactory implements FieldDefinitionFactory { public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }  CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor);  }