Search in sources :

Example 11 with ManifestAttribute

use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.

the class ManifestAttributeTest method shouldNotWrapOriginalLines.

@Test
public void shouldNotWrapOriginalLines() throws Exception {
    // given
    StringWriter writer = new StringWriter();
    // when
    ManifestAttribute attribute = new ManifestAttribute("headername: abcdefghijklmnopq");
    attribute.add(" rstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
    attribute.add(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
    attribute.add(" abcdefghijklmnop");
    attribute.add(" qrstuvwxyzABCDE");
    attribute.add(" FGHIJKLMNOPQRSTUVWXYZ0123");
    attribute.add(" 456789");
    attribute.writeTo(writer, "\n");
    // then
    assertEquals("headername: abcdefghijklmnopq\n" + " rstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n" + " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n" + " abcdefghijklmnop\n" + " qrstuvwxyzABCDE\n" + " FGHIJKLMNOPQRSTUVWXYZ0123\n" + " 456789\n", writer.toString());
}
Also used : StringWriter(java.io.StringWriter) ManifestAttribute(org.eclipse.tycho.versions.bundle.ManifestAttribute) Test(org.junit.Test)

Example 12 with ManifestAttribute

use of org.eclipse.tycho.versions.bundle.ManifestAttribute in project tycho by eclipse.

the class ManifestAttributeTest method shouldCreateWithOldMacLine.

@Test
public void shouldCreateWithOldMacLine() {
    // given
    String key = "headername";
    String value = "headervalue";
    String line = key + ": " + value + "\r";
    // when
    ManifestAttribute attribute = new ManifestAttribute(line);
    // then
    assertEquals(value, attribute.getValue());
    assertTrue(attribute.hasName(key));
}
Also used : ManifestAttribute(org.eclipse.tycho.versions.bundle.ManifestAttribute) Test(org.junit.Test)

Aggregations

ManifestAttribute (org.eclipse.tycho.versions.bundle.ManifestAttribute)12 Test (org.junit.Test)12 StringWriter (java.io.StringWriter)3 MutableBundleManifest (org.eclipse.tycho.versions.bundle.MutableBundleManifest)1 MutablePomFileTest (org.eclipse.tycho.versions.pom.tests.MutablePomFileTest)1