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"));
}
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));
}
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"));
}
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());
}
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));
}
Aggregations