github added test for repeated header support.
@@ -128,6 +128,36 @@ private void blankLineTest()
}
}
+ private void repeatHeaderTest()
+ throws Exception
+ {
+ ByteArrayOutputStream bOut = new ByteArrayOutputStream();
+ ArmoredOutputStream aOut = new ArmoredOutputStream(bOut);
+
+ aOut.setHeader("Comment", "Line 1");
+ aOut.addHeader("Comment", "Line 2");
+
+ aOut.write(sample);
+
+ aOut.close();
+
+ ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray());
+ ArmoredInputStream aIn = new ArmoredInputStream(bIn, true);
+
+ String[] hdrs = aIn.getArmorHeaders();
+ int count = 0;
+
+ for (int i = 0; i != hdrs.length; i++)
+ {
+ if (hdrs[i].indexOf("Comment: ") == 0)
+ {
+ count++;
+ }
+ }
+
+ isEquals(2, count);
+ }
+
public void performTest()
throws Exception
{
@@ -261,6 +291,7 @@ public void performTest()
blankLineTest();
pgpUtilTest();
+ repeatHeaderTest();
}
public String getName()
