. * This test does not verify that the digests are correct. */ public class LineBreaks { static final String KEY = "Key"; static final String VALUE = "Value"; static final String SECTION = "Section"; static final String FOO = "Foo"; static final String BAR = "Bar"; static final String EXCEED_LINE_WIDTH_LIMIT = "x".repeat(71); String breakAndContinue(String str, String lineBreak) { // assert no multi-byte UTF-8 encoded characters in this test assertEquals(str.getBytes(UTF_8).length, str.length()); int p = 1; while (p + 71 < str.length()) { p += 71; str = str.substring(0, p) + lineBreak + " " + str.substring(p); p += lineBreak.length() + 1; } return str; } byte[] createTestManifest(String lineBreak, boolean onlyMainAttrs, String excess) throws IOException { System.out.println("lineBreak = " + Utils.escapeStringWithNumbers(lineBreak)); System.out.println("onlyMainAttrs = " + onlyMainAttrs); String mf = ""; mf += breakAndContinue( KEY + ": " + VALUE + excess, lineBreak) + lineBreak; mf += lineBreak; if (!onlyMainAttrs) { mf += breakAndContinue( "Name: " + SECTION + excess, lineBreak) + lineBreak; mf += breakAndContinue( FOO + ": " + BAR + excess, lineBreak) + lineBreak; mf += lineBreak; } byte[] mfBytes = mf.getBytes(UTF_8); Utils.echoManifest(mfBytes, "binary manifest"); return mfBytes; } @DataProvider(name = "parameters") public static Object[][] parameters() { Listnewline: CR LF | LF | CR (not followed by LF)