static void check(StringFormatter formatter, String correct, String input, Object... args) { try { String result = formatter.format(input, args); if (!result.equals(correct)) { System.err.println("Mine : " + result); System.err.println("Correct: " + correct); System.exit(1); } } catch (Exception ex) { System.err.println("Unexpected exception: " + ex.getMessage()); System.err.println(ex.getMessage()); System.exit(1); } }
static void checkForFall( StringFormatter formatter, String correct, String input, Object... args) { try { formatter.format(input, args); System.err.println("No exception thrown."); System.exit(1); } catch (FormatterException fex) { if (!fex.getMessage().equals(correct)) { System.err.println("Mine : " + fex.getMessage()); System.err.println("Correct: " + correct); System.exit(1); } } }
public String toString() { return StringFormatter.format("%s,%s,%d", x, y, infFlag); }