Search in sources :

Example 1 with ManifestAttribute

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

the class ManifestAttributeTest method shouldAddLine.

@Test
public void shouldAddLine() {
    // given
    String line1 = "headername: headervalue1\n";
    String line2 = " headervalue2\n";
    String line3 = " headervalue3";
    // when
    ManifestAttribute attribute = new ManifestAttribute(line1);
    attribute.add(line2);
    attribute.add(line3);
    // then
    assertEquals("headervalue1headervalue2headervalue3", attribute.getValue());
    assertTrue(attribute.hasName("headername"));
    assertFalse(attribute.hasName("headernames"));
    assertFalse(attribute.hasName("header"));
}
Also used : ManifestAttribute(org.eclipse.tycho.versions.bundle.ManifestAttribute) Test(org.junit.Test)

Example 2 with ManifestAttribute

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

the class ManifestAttributeTest method shouldCreateWithChoppedLine.

@Test
public void shouldCreateWithChoppedLine() {
    // given
    String key = "headername";
    String value = "headervalue";
    String line = key + ": " + value;
    // 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)

Example 3 with ManifestAttribute

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

the class ManifestAttributeTest method shouldCreateWithParameters.

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

Example 4 with ManifestAttribute

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

the class ManifestAttributeTest method shouldWriteToWithUnixNewLine.

@Test
public void shouldWriteToWithUnixNewLine() throws Exception {
    // given
    StringWriter writer = new StringWriter();
    String name = "headername";
    String value = "headervalue";
    // when
    ManifestAttribute attribute = new ManifestAttribute(name, value);
    attribute.writeTo(writer, "\n");
    // then
    assertEquals(name + ": " + value + "\n", writer.toString());
}
Also used : StringWriter(java.io.StringWriter) ManifestAttribute(org.eclipse.tycho.versions.bundle.ManifestAttribute) Test(org.junit.Test)

Example 5 with ManifestAttribute

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

the class ManifestAttributeTest method shouldCreateWithUnixLine.

@Test
public void shouldCreateWithUnixLine() {
    // given
    String key = "headername";
    String value = "headervalue";
    String line = key + ": " + value + "\n";
    // 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