### Question:
YamlScriptSortMemberSupport { public String sortAscending(String input) { if (input == null) { return ""; } String[] documents = input.split("---"); StringBuilder sb = new StringBuilder(); for (int i = 0; i < documents.length; i++) { String document = documents[i]; String sortedDocument = sortAscendingSingleDocument(document); sb.append(sortedDocument); if (i< documents.length-1) { sb.append("---\n"); } } return sb.toString(); } YamlScriptSortMemberSupport(); String sortAscending(String input); String sortAscendingSingleDocument(String input); boolean isHavingCommentsInside(String yamlContent);  }### Answer:
@Test public void simple_sort_ascending_all_on_empty_string() { String input = ""; String expected = "" ; String result = supportToTest.sortAscending(input); assertEquals(expected,result); }
@Test public void simple_sort_ascending_all() { String input = "x:\n" + " c: 1\n" + " b: 2\n" + "a:\n" + " d: 3\n" + " a: 4"; String expected = "a:\n" + " a: 4\n" + " d: 3\n" + "x:\n" + " b: 2\n" + " c: 1\n" ; String result = supportToTest.sortAscending(input); assertEquals(expected,result); }
@Test public void simple_sort_ascending_all_when_blocks() { String input = "x:\n" + " c: 1\n" + " b: 2\n" + "a:\n" + " d: 3\n" + " a: 4\n" + "---\n"+ "h:\n"+ " c: 1\n" + " b: 2\n" + "g:\n" + " d: 3\n" + " a: 4\n"; String expected = "a:\n" + " a: 4\n" + " d: 3\n" + "x:\n" + " b: 2\n" + " c: 1\n" + "---\n"+ "g:\n" + " a: 4\n" + " d: 3\n" + "h:\n" + " b: 2\n" + " c: 1\n" ; String result = supportToTest.sortAscending(input); assertEquals(expected,result); }