BatchParserCommon { public static Line removeEndingCRLF(final Line line) { Matcher matcher = PATTERN_LAST_CRLF.matcher(line.toString()); if (matcher.matches()) { return new Line(matcher.group(1), line.getLineNumber()); } else { return line; } } private  BatchParserCommon(); static String getBoundary(final String contentType, final int line); static ContentType parseContentType(final String contentType, final ContentType expected, final int line); static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary); static Line removeEndingCRLF(final Line line); static Header consumeHeaders(final List<Line> remainingMessage); static void consumeBlankLine(final List<Line> remainingMessage, final boolean isStrict); static InputStream convertLineListToInputStream(final List<Line> messageList, final Charset charset); static String trimLineListToLength(final List<Line> list, final int length); static InputStream convertLineListToInputStream(final List<Line> list, final Charset charset,
      final int length); static final String CONTENT_TRANSFER_ENCODING; static final String BINARY_ENCODING; }
@Test public void removeEndingCRLF() { String line = "Test" + CRLF; assertEquals("Test", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeLastEndingCRLF() { String line = "Test" + CRLF + CRLF; assertEquals("Test" + CRLF, BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeEndingCRLFWithWS() { String line = "Test" + CRLF + " "; assertEquals("Test", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeEndingCRLFNothingToRemove() { String line = "Hallo" + CRLF + "Bla"; assertEquals(line, BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeEndingCRLFAll() { String line = CRLF; assertEquals("", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeEndingCRLFSpace() { String line = CRLF + " "; assertEquals("", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeLastEndingCRLFWithWS() { String line = "Test " + CRLF; assertEquals("Test ", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }
@Test public void removeLastEndingCRLFWithWSLong() { String line = "Test " + CRLF + "Test2 " + CRLF; assertEquals("Test " + CRLF + "Test2 ", BatchParserCommon.removeEndingCRLF(new Line(line, 1)).toString()); }