@Test public void testGetSetterCommandsNestedRecord() { final Field dq8Field = mockField("F8_FIELD", DataType.F8); final Structure nestedStructure = mockStructure(dq8Field); final Record nestedRecord = mockRecord(null, nestedStructure); when(nestedRecord.getF8("F8_FIELD")).thenReturn(123.456); final Field recordField = mockField("NESTED_RECORD", DataType.RECORD); final Structure rootStructure = mockStructure(recordField); final Record rootRecord = mockRecord("ROOT", rootStructure); when(rootRecord.getRecord(recordField.getName())).thenReturn(nestedRecord); assertThat(RecordSetter.getSetterCommands(rootRecord)) .containsOnly("set ROOT->NESTED_RECORD->F8_FIELD = 123.456000 go"); }
public static List<String> getSetterCommands(final Record record) { final List<String> commands = new ArrayList<String>(); final BreadCrumb rootCrumb = new BreadCrumb(record.getName()); for (final Field field : record.getStructure().getFields()) getSetterCommands(rootCrumb, field, record, commands); return commands; }
RecordSetter { public static List<String> getSetterCommands(final Record record) { final List<String> commands = new ArrayList<String>(); final BreadCrumb rootCrumb = new BreadCrumb(record.getName()); for (final Field field : record.getStructure().getFields()) getSetterCommands(rootCrumb, field, record, commands); return commands; } }
RecordSetter { public static List<String> getSetterCommands(final Record record) { final List<String> commands = new ArrayList<String>(); final BreadCrumb rootCrumb = new BreadCrumb(record.getName()); for (final Field field : record.getStructure().getFields()) getSetterCommands(rootCrumb, field, record, commands); return commands; }  }
RecordSetter { public static List<String> getSetterCommands(final Record record) { final List<String> commands = new ArrayList<String>(); final BreadCrumb rootCrumb = new BreadCrumb(record.getName()); for (final Field field : record.getStructure().getFields()) getSetterCommands(rootCrumb, field, record, commands); return commands; }  static List<String> getSetterCommands(final Record record); }
RecordSetter { public static List<String> getSetterCommands(final Record record) { final List<String> commands = new ArrayList<String>(); final BreadCrumb rootCrumb = new BreadCrumb(record.getName()); for (final Field field : record.getStructure().getFields()) getSetterCommands(rootCrumb, field, record, commands); return commands; }  static List<String> getSetterCommands(final Record record);  }