Ignore:
Timestamp:
2014-05-09T04:49:54+02:00 (8 years ago)
Author:
Don-vip
Message:

fixes for unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy

    r7068 r7081  
    55
    66import org.junit.*
    7 import org.openstreetmap.josm.JOSMFixture;
     7import org.openstreetmap.josm.JOSMFixture
    88import org.openstreetmap.josm.data.coor.LatLon
    99import org.openstreetmap.josm.data.osm.DataSet
     
    1919
    2020    def shouldFail = new GroovyTestCase().&shouldFail
    21    
     21
    2222    def DataSet ds;
    23    
     23
    2424    @BeforeClass
    2525    public static void createJOSMFixture(){
    2626        JOSMFixture.createUnitTestFixture().init()
    2727    }
    28    
     28
    2929    @Before
    3030    public void setUp() {
    3131        ds = new DataSet()
    3232    }
    33    
     33
    3434    def relation(id) {
    3535        def r = new Relation(id,1)
     
    3737        return r
    3838    }
    39    
     39
    4040    def node(id) {
    4141        def n = new Node(id,1)
     
    4444        return n
    4545    }
    46    
     46
    4747    @Test
    4848    public void create() {
    49         Condition c = Condition.create("a key", "a value", Op.EQ, Context.PRIMITIVE)
    50        
    51         c = Condition.create("role", "a role", Op.EQ, Context.LINK)
    52         c = Condition.create("RoLe", "a role", Op.EQ, Context.LINK)
    53        
     49        Condition c = Condition.createKeyValueCondition("a key", "a value", Op.EQ, Context.PRIMITIVE, false)
     50
     51        c = Condition.createKeyValueCondition("role", "a role", Op.EQ, Context.LINK, false)
     52        c = Condition.createKeyValueCondition("RoLe", "a role", Op.EQ, Context.LINK, false)
     53
    5454        shouldFail(MapCSSException) {
    55             c = Condition.create("an arbitry tag", "a role", Op.EQ, Context.LINK)
     55            c = Condition.createKeyValueCondition("an arbitry tag", "a role", Op.EQ, Context.LINK, false)
    5656        }
    5757    }
    58    
     58
    5959    @Test
    6060    public void applies_1() {
     
    6262        Node n = node(1)
    6363        r.addMember(new RelationMember("my_role", n))
    64        
     64
    6565        Environment e = new Environment().withPrimitive(n).withParent(r).withLinkContext().withIndex(0)
    66        
     66
    6767        Condition cond = new Condition.RoleCondition("my_role", Op.EQ)
    68         assert cond.applies(e)       
    69        
     68        assert cond.applies(e)
     69
    7070        cond = new Condition.RoleCondition("another_role", Op.EQ)
    7171        assert !cond.applies(e)
    7272    }
    73    
     73
    7474    @Test
    7575    public void applies_2() {
     
    7777        Node n = node(1)
    7878        r.addMember(new RelationMember("my_role", n))
    79        
     79
    8080        Environment e = new Environment().withPrimitive(n).withParent(r).withIndex(0).withLinkContext()
    81        
    82         Condition cond = Condition.create("role", "my_role", Op.NEQ, Context.LINK)
     81
     82        Condition cond = Condition.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false)
    8383        assert !cond.applies(e)
    84        
    85         cond = Condition.create("role", "another_role", Op.NEQ, Context.LINK)
     84
     85        cond = Condition.createKeyValueCondition("role", "another_role", Op.NEQ, Context.LINK, false)
    8686        assert cond.applies(e)
    8787    }
    88    
    89    
    90    
    9188}
    92 
Note: See TracChangeset for help on using the changeset viewer.