### Question:
MfgRecordProcessor implements RecordProcessor<MfgData> { public MfgData process(String[] col) throws BadDataException { if (col.length < 2) { throw new BadDataException("too few columns"); } else if (col.length > 2) { throw new BadDataException("too many columns"); } return new MfgData(col[0], col[1]); }  MfgData process(String[] col);  }### Answer:
@Test(expected=BadDataException.class) public void processTooFewCols() throws BadDataException { final RecordProcessor<MfgData> proc = new MfgRecordProcessor(); proc.process(new String[] { "foo" }); }
@Test(expected=BadDataException.class) public void processTooManyCols() throws BadDataException { final RecordProcessor<MfgData> proc = new MfgRecordProcessor(); proc.process(new String[] { "foo", "foo", "foo" }); }
@Test public void processJustRightCols() throws BadDataException { final String code = "SPFT"; final String name = "Stay Puft Marshmallow Corporation"; final MfgData md = new MfgData(code, name); final RecordProcessor<MfgData> proc = new MfgRecordProcessor(); assertEquals(md, proc.process(new String[] { md.code, md.name })); }