Ignore:
Timestamp:
2017-04-22T17:57:11+02:00 (4 years ago)
Author:
Don-vip
Message:

add unit tests, javadoc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java

    r11057 r11974  
    237237
    238238    @Test
     239    public void testSetAnd() throws ParseError {
     240        TemplateParser parser = new TemplateParser("!{(parent(type=child) type=parent) & (parent type=child subtype=parent) '{name}'}");
     241        DatasetFactory ds = new DatasetFactory();
     242        Relation parent1 = ds.addRelation(1);
     243        parent1.put("type", "parent");
     244        parent1.put("subtype", "parent");
     245        parent1.put("name", "name_parent1");
     246        Node child = ds.addNode(1);
     247        child.put("type", "child");
     248        parent1.addMember(new RelationMember("", child));
     249
     250        StringBuilder sb = new StringBuilder();
     251        TemplateEntry entry = parser.parse();
     252        entry.appendText(sb, child);
     253
     254        Assert.assertEquals("name_parent1", sb.toString());
     255    }
     256
     257    @Test
    239258    public void testSetOr() throws ParseError {
    240259        TemplateParser parser = new TemplateParser("!{(parent(type=type1) type=parent1) | (parent type=type2 type=parent2) '{name}'}");
Note: See TracChangeset for help on using the changeset viewer.