1   package com.lexicalscope.jewel;
2   
3   import java.util.Arrays;
4   import java.util.List;
5   
6   /**
7    * Utils to help testing
8    *
9    * @author Tim Wood
10   */
11  public class UtilitiesForTesting
12  {
13     private final static String lineSeparator = System.getProperty("line.separator");
14  
15     /**
16      * Join the lines together with the platform separator
17      *
18      * @param lines The lines to join together
19      *
20      * @return The lines joined together
21      */
22     public static String joinLines(final String... lines)
23     {
24        final StringBuilder result = new StringBuilder();
25  
26        String separator = "";
27        for (final String line : lines)
28        {
29           result.append(separator).append(line);
30           separator = lineSeparator;
31        }
32        return result.toString();
33     }
34  
35     public static List<String> splitLines(final String helpMessage)
36     {
37        return Arrays.asList(helpMessage.split(lineSeparator));
38     }
39  }