@Test public void testGetSetterCommandsCharSingleQuote() { final String fieldName = "char_field"; final String recordName = "record_name"; final String value = "test o'auth"; final int dataLength = value.length(); final Field field = mockCharacterField(fieldName, dataLength); final Structure struct = mockStructure(field); final Record record = mockRecord(recordName, struct); when(record.getChar(fieldName)).thenReturn(value); final List<String> commands = RecordSetter.getSetterCommands(record); assertThat(commands).containsExactly("set record_name->char_field = ", "concat(", "'test o'", ", \"'\"", ", 'auth'", ")", "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);  }