use of org.springframework.ide.vscode.commons.yaml.path.YamlPath in project sts4 by spring-projects.
the class YamlStructureParserTest method testTraverseSeq.
@Test
public void testTraverseSeq() throws Exception {
MockYamlEditor editor = new MockYamlEditor("foo:\n" + "- - - - a\n" + " - c\n" + "- e");
SRootNode root = editor.parseStructure();
YamlPath path;
path = pathWith(0, "foo", 0, 0, 0, 0);
assertEquals("SEQ(6): - a\n", path.traverse((SNode) root).toString());
path = pathWith(0, "foo", -1);
assertNull(path.traverse((SNode) root));
path = pathWith(0, "foo", 1);
assertEquals("SEQ(0): - e\n", path.traverse((SNode) root).toString());
path = pathWith(0, "foo", 2);
assertNull(path.traverse((SNode) root));
}
use of org.springframework.ide.vscode.commons.yaml.path.YamlPath in project sts4 by spring-projects.
the class YamlStructureParserTest method findAndTraversPathPath.
private void findAndTraversPathPath(MockYamlEditor editor, String snippet) throws Exception {
SRootNode root = editor.parseStructure();
SNode node = root.find(editor.startOf(snippet));
assertNotNull(node);
YamlPath path = node.getPath();
SNode actualNode = path.traverse((SNode) root);
assertEquals(node, actualNode);
}
Aggregations