Preferences { public static String encode(final ScriptInfo[] infos) { final StringBuilder buf = new StringBuilder(); for (int i=0; i<infos.length; ++i) { if (i > 0) buf.append(','); buf.append('"').append(infos[i].getDescription()).append('"') .append('|') .append('"').append(infos[i].getScript()).append('"'); } return buf.toString(); }  static boolean getRunIndividualScripts(); static ScriptInfo[] getCommandInfos(); static String encode(final ScriptInfo[] infos); static ScriptInfo[] decode(final String script_list); final static String PREV_INDIVIDUAL; }
@Test public void testEncode() { final ScriptInfo[] infos = new ScriptInfo[] { new ScriptInfo("Hello", "cmd1 -opt"), new ScriptInfo("Good bye", "cmd2"), }; final String encoded = Preferences.encode(infos); System.out.println(encoded); assertEquals(ENCODED, encoded); }