@@ -0,0 +1,2761 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage com.lagunex.util;%0A%0Aimport java.time.LocalDateTime;%0Aimport java.time.Month;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0A%0A/**%0A *%0A * @author Carlos A. Henr%C3%ADquez Q. %3Ccarlos.henriquez@lagunex.com%3E%0A */%0Apublic class StringUtilsTest %7B%0A    %0A    @Test%0A    public void collapseLines() %7B%0A        String multiLines = %22line1%5Cnline2%5Cnline3%22;%0A        String singleLine = %22line1%5C%5Cnline2%5C%5Cnline3%22;%0A        assertEquals(singleLine, StringUtils.collapseLines(multiLines));%0A    %7D %0A%0A    @Test%0A    public void collapseLinesWithOneLineString() %7B%0A        String singleLine = %22line1%22;%0A        assertEquals(singleLine, StringUtils.collapseLines(singleLine));%0A    %7D%0A%0A    @Test%0A    public void uncollapseLines() %7B%0A        String multiLines = %22line1%5Cnline2%5Cnline3%22;%0A        String singleLine = %22line1%5C%5Cnline2%5C%5Cnline3%22;%0A        assertEquals(multiLines, StringUtils.uncollapseLines(singleLine));%0A    %7D%0A%0A    @Test%0A    public void uncollapseLinesWithOneLineString() %7B%0A        String singleLine = %22line1%22;%0A        assertEquals(singleLine, StringUtils.uncollapseLines(singleLine));%0A    %7D%0A    %0A    @Test%0A    public void escape() %7B%0A        String lineWithReservedChar = %22line%7Cwith%7Creserved chars%7C%5C%5C%22;%0A        String escapedLine = %22line%5C%5C%7Cwith%5C%5C%7Creserved chars%5C%5C%7C%5C%5C %22;%0A        assertEquals(escapedLine, StringUtils.escape(lineWithReservedChar));%0A    %7D%0A    %0A    @Test%0A    public void escapeWithCustomReservedChar() %7B%0A        String reservedChar = %22&%22;%0A        String lineWithReservedChar = %22line&with&reserved %7Cchars&%5C%5C%22;%0A        String escapedLine = %22line%5C%5C&with%5C%5C&reserved %7Cchars%5C%5C&%5C%5C %22;%0A        assertEquals(escapedLine, StringUtils.escape(lineWithReservedChar, reservedChar));%0A    %7D%0A    %0A    @Test%0A    public void unescape() %7B%0A        String lineWithReservedChar = %22line%7Cwith%7Creserved chars%7C%5C%5C%22;%0A        String escapedLine = %22line%5C%5C%7Cwith%5C%5C%7Creserved chars%5C%5C%7C%5C%5C %22;%0A        assertEquals(lineWithReservedChar, StringUtils.unescape(escapedLine));%0A    %7D%0A    %0A    @Test%0A    public void unescapeWithCustomReservedChar() %7B%0A        String reservedChar = %22&%22;%0A        String lineWithReservedChar = %22line&with&reserved %7Cchars&%5C%5C%22;%0A        String escapedLine = %22line%5C%5C&with%5C%5C&reserved %7Cchars%5C%5C&%5C%5C %22;%0A        assertEquals(lineWithReservedChar, StringUtils.unescape(escapedLine, reservedChar));%0A    %7D%0A%0A    @Test%0A    public void formatDateTime() %7B%0A        LocalDateTime time = LocalDateTime.of(2015, Month.MARCH, 10, 13, 20);%0A        assertEquals(%222015-03-10 13:20:00%22, StringUtils.formatDateTime(time));%0A        assertEquals(%222015-03-10 13:20:15%22, StringUtils.formatDateTime(time.withSecond(15)));%0A    %7D%0A%7D%0A

add JUnit to project