void (@NotNull JTree tree, @NotNull String expected, boolean checkSelected, boolean ignoreOrder) { String treeStringPresentation = print(tree, checkSelected); if (ignoreOrder) { List<String> actualLines = sorted(ContainerUtil.map(splitByLines(treeStringPresentation), String::trim)); List<String> expectedLines = sorted(ContainerUtil.map(splitByLines(expected), String::trim)); assertEquals("Expected:\n" + expected + "\nActual:\n" + treeStringPresentation, expectedLines, actualLines); } else { assertSameLines(expected.trim(), treeStringPresentation.trim()); } }