use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.
the class ManifestAttributeTest method shouldFailOnAddLineWithNewLines.
@Test(expected = IllegalArgumentException.class)
public void shouldFailOnAddLineWithNewLines() {
// given
String line1 = "headername: headervalue1";
String line2 = " header\n value2\n";
// when
ManifestAttribute attribute = new ManifestAttribute(line1);
attribute.add(line2);
}
use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.
the class ManifestAttributeTest method shouldWriteToWithWindowsNewLine.
@Test
public void shouldWriteToWithWindowsNewLine() throws Exception {
// given
StringWriter writer = new StringWriter();
String name = "headername";
String value = "headervalue";
// when
ManifestAttribute attribute = new ManifestAttribute(name, value);
attribute.writeTo(writer, "\r\n");
// then
assertEquals(name + ": " + value + "\r\n", writer.toString());
}
use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.
the class MutableBundleManifestTest method addAttribute.
@Test
public void addAttribute() throws Exception {
MutableBundleManifest mf = getManifest("/manifests/addheader.mf");
mf.add(new ManifestAttribute("header", "value"));
assertContents(mf, "/manifests/addheader.mf_expected");
}
use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.
the class ManifestAttributeTest method shouldCreateWithWindowsLine.
@Test
public void shouldCreateWithWindowsLine() {
// given
String key = "headername";
String value = "headervalue";
String line = key + ": " + value + "\r\n";
// when
ManifestAttribute attribute = new ManifestAttribute(line);
// then
assertEquals(value, attribute.getValue());
assertTrue(attribute.hasName(key));
}
use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.
the class ManifestAttributeTest method shouldGetValue.
@Test
public void shouldGetValue() throws Exception {
// given
String name = "headername";
String value = "headervalue";
String valuelong = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
// when
ManifestAttribute attribute0 = new ManifestAttribute(name, value);
ManifestAttribute attribute1 = new ManifestAttribute(name, valuelong);
ManifestAttribute attribute2 = new ManifestAttribute(name + ": " + valuelong);
ManifestAttribute attribute3 = new ManifestAttribute(name + ": abcdefghijklmnopq");
attribute3.add(" rstuvwxyzABCDEFGHIJKLMN");
attribute3.add(" OPQRSTUVWXYZ0123456789");
attribute3.add(" abcdefghijklmnop");
attribute3.add(" qrstuvwxyzABCDE");
attribute3.add(" FGHIJKLMNOPQRSTUVWXYZ0123");
attribute3.add(" 456789");
// then
assertEquals(value, attribute0.getValue());
assertEquals(valuelong, attribute1.getValue());
assertEquals(valuelong, attribute2.getValue());
assertEquals(valuelong, attribute3.getValue());
}
Aggregations