/** * tests splitOptions and joinOptions * * @see Utils#splitOptions(String) * @see Utils#joinOptions(String[]) */ public void testSplittingAndJoining() { String[] options; String[] newOptions; String joined; int i; try { options = new StringToWordVector().getOptions(); joined = Utils.joinOptions(options); newOptions = Utils.splitOptions(joined); assertEquals("Same number of options", options.length, newOptions.length); for (i = 0; i < options.length; i++) { if (!options[i].equals(newOptions[i])) fail("Option " + (i+1) + " differs"); } } catch (Exception e) { fail("Exception: " + e); } }
/** * tests splitOptions and joinOptions * * @see Utils#splitOptions(String) * @see Utils#joinOptions(String[]) */ public void testSplittingAndJoining() { String[] options; String[] newOptions; String joined; int i; try { options = new StringToWordVector().getOptions(); joined = Utils.joinOptions(options); newOptions = Utils.splitOptions(joined); assertEquals("Same number of options", options.length, newOptions.length); for (i = 0; i < options.length; i++) { if (!options[i].equals(newOptions[i])) fail("Option " + (i+1) + " differs"); } } catch (Exception e) { fail("Exception: " + e); } }
/** * tests backQuoteChars and unbackQuoteChars * * @see Utils#backQuoteChars(String) * @see Utils#unbackQuoteChars(String) */ public void testBackQuoting() { String input; String output; input = "blahblah"; output = Utils.backQuoteChars(input); assertTrue("No backquoting necessary", input.equals(output)); input = "\r\n\t'\"%"; output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); input = "\\r\\n\\t\\'\\\"\\%"; output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); input = Utils.joinOptions(new StringToWordVector().getOptions()); output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); }
/** * tests backQuoteChars and unbackQuoteChars * * @see Utils#backQuoteChars(String) * @see Utils#unbackQuoteChars(String) */ public void testBackQuoting() { String input; String output; input = "blahblah"; output = Utils.backQuoteChars(input); assertTrue("No backquoting necessary", input.equals(output)); input = "\r\n\t'\"%"; output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); input = "\\r\\n\\t\\'\\\"\\%"; output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); input = Utils.joinOptions(new StringToWordVector().getOptions()); output = Utils.backQuoteChars(input); assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output))); }