void (boolean moveLeft, String before, String... after) { String current = before; for (String next : after) { doTestSingle(moveLeft, current, next); current = next; } doTestSingle(moveLeft, current, current); if (after.length == 0) return; for (int i = after.length - 2; i >= 0; i--) { String prev = after[i]; doTestSingle(!moveLeft, current, prev); current = prev; } doTestSingle(!moveLeft, current, before); }