use of org.jetbrains.lang.manifest.psi.HeaderValue in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method testClauses.
public void testClauses() {
ManifestFile file = createFile("Import-Package: a.b,c.d;a=value;d:=value");
Header header = file.getHeader("Import-Package");
assertNotNull(header);
List<HeaderValue> clauses = header.getHeaderValues();
assertEquals(2, clauses.size());
Clause clause1 = (Clause) clauses.get(0), clause2 = (Clause) clauses.get(1);
assertEquals(0, clause1.getAttributes().size());
assertEquals(0, clause1.getDirectives().size());
assertEquals(1, clause2.getAttributes().size());
assertEquals(1, clause2.getDirectives().size());
assertNotNull(clause2.getAttribute("a"));
assertNull(clause2.getAttribute("b"));
assertNotNull(clause2.getDirective("d"));
assertNull(clause2.getDirective("z"));
}
use of org.jetbrains.lang.manifest.psi.HeaderValue in project intellij-plugins by JetBrains.
the class OsgiManifestPsiTest method assertAssignment.
private static void assertAssignment(ManifestFile file, boolean attribute, String name, String expected) {
List<Header> headers = file.getHeaders();
assertEquals(1, headers.size());
List<HeaderValue> clauses = headers.get(0).getHeaderValues();
assertEquals(1, clauses.size());
assertTrue(clauses.get(0) instanceof Clause);
Clause clause = (Clause) clauses.get(0);
AssignmentExpression element = attribute ? clause.getAttribute(name) : clause.getDirective(name);
if (expected != null) {
assertNotNull(element);
assertEquals(expected, element.getValue());
} else {
assertNull(element);
}
}
Aggregations