Compares the lines in two strings checking that the expected lines are prefixes of the actual lines. @param expected a string. @param actual a string. @param sort true iff the lines aer to be sorted before a comparison is done (use it if there is non-determinism in the order of the results) @return
(final String expected, final String actual, final boolean sort)
| 737 | * @return true if ll the expected lines are prefixes of the actual lines. |
| 738 | */ |
| 739 | public static boolean startLines(final String expected, final String actual, final boolean sort) { |
| 740 | final String[] erecs = splitLines(expected.trim()); |
| 741 | if (sort) { |
| 742 | Arrays.sort(erecs); |
| 743 | } |
| 744 | final String[] arecs = splitLines(actual.trim()); |
| 745 | if (sort) { |
| 746 | Arrays.sort(arecs); |
| 747 | } |
| 748 | final boolean same = startLines(erecs, arecs); |
| 749 | if (!same) { |
| 750 | System.err.println("Actual output was:\n" + actual); |
| 751 | System.err.println("Expected output was:\n" + expected); |
| 752 | } |
| 753 | return same; |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * Checks whether the expected lines are prefixes of the actual lines. |
nothing calls this directly
no test coverage detected