For a JUnit test I need a String which consists of multiple lines. But all I get is a single lined String. I tried the following:
String str = ";;;;;;\n" +
"Name, number, address;;;;;;\n" +
"01.01.12-16.02.12;;;;;;\n" +
";;;;;;\n" +
";;;;;;";
I also tried \n\r instead of \n. System.getProperty(“line.separator”) doesn’t work too. it produces a \n in String and no carriage return. So how can I solve that?
Thanks for your answers. I missed that my data is stored in a
List<String>which is passed to the tested method. The mistake was that I put the string into the first element of the ArrayList. That’s why I thought the String consists of just one single line, because the debugger showed me only one entry.