Changeset 10837 in josm for trunk/test


Ignore:
Timestamp:
2016-08-18T03:39:22+02:00 (3 years ago)
Author:
Don-vip
Message:

see #11924 - extract MapCSS conditions to new class ConditionFactory (on the same model than ExpressionFactory) - should workaround Groovy bug with Java 9 (https://issues.apache.org/jira/browse/GROOVY-7879 ?)

Location:
trunk/test
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSConditionPerformanceTest.java

    r10674 r10837  
    66import org.junit.Test;
    77import org.openstreetmap.josm.PerformanceTestUtils;
    8 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op;
     8import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
    99
    1010/**
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionTest.java

    r10674 r10837  
    1313import org.openstreetmap.josm.gui.mappaint.Environment;
    1414import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
    15 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op;
    16 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.SimpleKeyValueCondition;
    1715import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.ToTagConvertable;
     16import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
     17import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.SimpleKeyValueCondition;
    1818import org.openstreetmap.josm.testutils.JOSMTestRules;
    1919
     
    5454    @Test
    5555    public void testKeyValueEq() {
    56         Condition op = Condition.createKeyValueCondition("k1", "v1", Op.EQ, Context.PRIMITIVE, false);
     56        Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.EQ, Context.PRIMITIVE, false);
    5757        assertFalse(op.applies(genEnv(node0)));
    5858        assertTrue(op.applies(genEnv(node1)));
     
    7272    @Test
    7373    public void testKeyValueEqAsKey() {
    74         Condition op = Condition.createKeyValueCondition("k1", "k2", Op.EQ, Context.PRIMITIVE, true);
     74        Condition op = ConditionFactory.createKeyValueCondition("k1", "k2", Op.EQ, Context.PRIMITIVE, true);
    7575        assertFalse(op.applies(genEnv(node0)));
    7676        assertTrue(op.applies(genEnv(node1)));
     
    8888    @Test
    8989    public void testKeyValueNeq() {
    90         Condition op = Condition.createKeyValueCondition("k1", "v1", Op.NEQ, Context.PRIMITIVE, false);
     90        Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.NEQ, Context.PRIMITIVE, false);
    9191        assertTrue(op.applies(genEnv(node0)));
    9292        assertFalse(op.applies(genEnv(node1)));
     
    101101    @Test
    102102    public void testKeyValueGreatherEq() {
    103         Condition op = Condition.createKeyValueCondition("f1", "0.2", Op.GREATER_OR_EQUAL, Context.PRIMITIVE, false);
     103        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER_OR_EQUAL, Context.PRIMITIVE, false);
    104104        assertFalse(op.applies(genEnv(node0)));
    105105        assertTrue(op.applies(genEnv(node1)));
     
    114114    @Test
    115115    public void testKeyValueGreather() {
    116         Condition op = Condition.createKeyValueCondition("f1", "0.2", Op.GREATER, Context.PRIMITIVE, false);
     116        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER, Context.PRIMITIVE, false);
    117117        assertFalse(op.applies(genEnv(node0)));
    118118        assertFalse(op.applies(genEnv(node1)));
     
    127127    @Test
    128128    public void testKeyValueLessEq() {
    129         Condition op = Condition.createKeyValueCondition("f1", "0.2", Op.LESS_OR_EQUAL, Context.PRIMITIVE, false);
     129        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS_OR_EQUAL, Context.PRIMITIVE, false);
    130130        assertFalse(op.applies(genEnv(node0)));
    131131        assertTrue(op.applies(genEnv(node1)));
     
    140140    @Test
    141141    public void testKeyValueLess() {
    142         Condition op = Condition.createKeyValueCondition("f1", "0.2", Op.LESS, Context.PRIMITIVE, false);
     142        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS, Context.PRIMITIVE, false);
    143143        assertFalse(op.applies(genEnv(node0)));
    144144        assertFalse(op.applies(genEnv(node1)));
     
    153153    @Test
    154154    public void testKeyValueRegex() {
    155         Condition op = Condition.createKeyValueCondition("r1", "(ab){2}", Op.REGEX, Context.PRIMITIVE, false);
     155        Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.REGEX, Context.PRIMITIVE, false);
    156156        assertFalse(op.applies(genEnv(node0)));
    157157        assertTrue(op.applies(genEnv(node1)));
     
    166166    @Test
    167167    public void testKeyValueNregex() {
    168         Condition op = Condition.createKeyValueCondition("r1", "(ab){2}", Op.NREGEX, Context.PRIMITIVE, false);
     168        Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.NREGEX, Context.PRIMITIVE, false);
    169169        assertTrue(op.applies(genEnv(node0)));
    170170        assertFalse(op.applies(genEnv(node1)));
     
    179179    @Test
    180180    public void testKeyValueOneOf() {
    181         Condition op = Condition.createKeyValueCondition("one", "a", Op.ONE_OF, Context.PRIMITIVE, false);
     181        Condition op = ConditionFactory.createKeyValueCondition("one", "a", Op.ONE_OF, Context.PRIMITIVE, false);
    182182        assertFalse(op.applies(genEnv(node0)));
    183183        assertTrue(op.applies(genEnv(node1)));
     
    192192    @Test
    193193    public void testKeyValueBeginsWith() {
    194         Condition op = Condition.createKeyValueCondition("c1", "xy", Op.BEGINS_WITH, Context.PRIMITIVE, false);
     194        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.BEGINS_WITH, Context.PRIMITIVE, false);
    195195        assertFalse(op.applies(genEnv(node0)));
    196196        assertTrue(op.applies(genEnv(node1)));
     
    205205    @Test
    206206    public void testKeyValueEndsWith() {
    207         Condition op = Condition.createKeyValueCondition("c1", "xy", Op.ENDS_WITH, Context.PRIMITIVE, false);
     207        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.ENDS_WITH, Context.PRIMITIVE, false);
    208208        assertFalse(op.applies(genEnv(node0)));
    209209        assertFalse(op.applies(genEnv(node1)));
     
    218218    @Test
    219219    public void testKeyValueContains() {
    220         Condition op = Condition.createKeyValueCondition("c1", "xy", Op.CONTAINS, Context.PRIMITIVE, false);
    221         assertFalse(op.applies(genEnv(node0)));
    222         assertTrue(op.applies(genEnv(node1)));
    223         assertTrue(op.applies(genEnv(node2)));
    224         assertTrue(op.applies(genEnv(node3)));
    225         assertTrue(op.applies(genEnv(node4)));
    226     }
    227 
    228     /**
    229      * Test of {@link Condition#createRegexpKeyRegexpValueCondition(String, String, Op)}
     220        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.CONTAINS, Context.PRIMITIVE, false);
     221        assertFalse(op.applies(genEnv(node0)));
     222        assertTrue(op.applies(genEnv(node1)));
     223        assertTrue(op.applies(genEnv(node2)));
     224        assertTrue(op.applies(genEnv(node3)));
     225        assertTrue(op.applies(genEnv(node4)));
     226    }
     227
     228    /**
     229     * Test of {@link ConditionFactory#createRegexpKeyRegexpValueCondition(String, String, Op)}
    230230     */
    231231    @Test
    232232    public void testRegexpKeyValueRegexpCondition() {
    233         Condition op = Condition.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.REGEX);
    234         assertFalse(op.applies(genEnv(node0)));
    235         assertFalse(op.applies(genEnv(node1)));
    236         assertTrue(op.applies(genEnv(node2)));
    237         assertFalse(op.applies(genEnv(node3)));
    238         assertTrue(op.applies(genEnv(node4)));
    239 
    240         Condition notOp = Condition.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.NREGEX);
     233        Condition op = ConditionFactory.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.REGEX);
     234        assertFalse(op.applies(genEnv(node0)));
     235        assertFalse(op.applies(genEnv(node1)));
     236        assertTrue(op.applies(genEnv(node2)));
     237        assertFalse(op.applies(genEnv(node3)));
     238        assertTrue(op.applies(genEnv(node4)));
     239
     240        Condition notOp = ConditionFactory.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.NREGEX);
    241241        assertTrue(notOp.applies(genEnv(node0)));
    242242        assertTrue(notOp.applies(genEnv(node1)));
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.groovy

    r9214 r10837  
    1313import org.openstreetmap.josm.gui.mappaint.Environment
    1414import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context
     15import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType
    1516
    1617class KeyConditionTest {
     
    4748
    4849        // ["a label"]
    49         Condition c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
     50        Condition c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.FALSE, Context.PRIMITIVE)
    5051        // ["a label"?]
    51         c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
     52        c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.TRUE, Context.PRIMITIVE)
    5253        // [!"a label"]
    53         c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.FALSE, Context.PRIMITIVE)
     54        c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.FALSE, Context.PRIMITIVE)
    5455        // [!"a label"?]
    55         c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.PRIMITIVE)
     56        c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.TRUE, Context.PRIMITIVE)
    5657
    5758        // ["a label"]
    58         c = Condition.createKeyCondition("a key", false, null, Context.LINK)
     59        c = ConditionFactory.createKeyCondition("a key", false, null, Context.LINK)
    5960        // [!"a label"]
    60         c = Condition.createKeyCondition("a key", true, null, Context.LINK)
     61        c = ConditionFactory.createKeyCondition("a key", true, null, Context.LINK)
    6162
    6263        shouldFail(MapCSSException) {
    6364            // ["a label"?]
    64            c = Condition.createKeyCondition("a key", false, Condition.KeyMatchType.TRUE, Context.LINK)
     65           c = ConditionFactory.createKeyCondition("a key", false, KeyMatchType.TRUE, Context.LINK)
    6566        }
    6667
    6768        shouldFail(MapCSSException) {
    6869            // [!"a label"?]
    69             c = Condition.createKeyCondition("a key", true, Condition.KeyMatchType.TRUE, Context.LINK)
     70            c = ConditionFactory.createKeyCondition("a key", true, KeyMatchType.TRUE, Context.LINK)
    7071        }
    7172    }
     
    7980        Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()
    8081
    81         Condition cond = Condition.createKeyCondition("my_role", false, null, Context.LINK)
     82        Condition cond = ConditionFactory.createKeyCondition("my_role", false, null, Context.LINK)
    8283        assert cond.applies(e)
    8384
    84         cond = Condition.createKeyCondition("my_role", true, null, Context.LINK)
     85        cond = ConditionFactory.createKeyCondition("my_role", true, null, Context.LINK)
    8586        assert !cond.applies(e)
    8687    }
     
    9495        Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()
    9596
    96         Condition cond = Condition.createKeyCondition("another_role", false, null, Context.LINK)
     97        Condition cond = ConditionFactory.createKeyCondition("another_role", false, null, Context.LINK)
    9798        assert !cond.applies(e)
    9899
    99         cond = Condition.createKeyCondition("another_role", true, null, Context.LINK)
     100        cond = ConditionFactory.createKeyCondition("another_role", true, null, Context.LINK)
    100101        assert cond.applies(e)
    101102    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.groovy

    r9247 r10837  
    1212import org.openstreetmap.josm.gui.mappaint.Environment
    1313import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context
    14 import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Op
     14import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op
    1515import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
    1616
     
    4747    @Test
    4848    public void create() {
    49         Condition c = Condition.createKeyValueCondition("a key", "a value", Op.EQ, Context.PRIMITIVE, false)
     49        Condition c = ConditionFactory.createKeyValueCondition("a key", "a value", Op.EQ, Context.PRIMITIVE, false)
    5050
    51         c = Condition.createKeyValueCondition("role", "a role", Op.EQ, Context.LINK, false)
    52         c = Condition.createKeyValueCondition("RoLe", "a role", Op.EQ, Context.LINK, false)
     51        c = ConditionFactory.createKeyValueCondition("role", "a role", Op.EQ, Context.LINK, false)
     52        c = ConditionFactory.createKeyValueCondition("RoLe", "a role", Op.EQ, Context.LINK, false)
    5353
    5454        shouldFail(MapCSSException) {
    55             c = Condition.createKeyValueCondition("an arbitry tag", "a role", Op.EQ, Context.LINK, false)
     55            c = ConditionFactory.createKeyValueCondition("an arbitry tag", "a role", Op.EQ, Context.LINK, false)
    5656        }
    5757    }
     
    6565        Environment e = new Environment(n).withParent(r).withLinkContext().withIndex(0, r.membersCount)
    6666
    67         Condition cond = new Condition.RoleCondition("my_role", Op.EQ)
     67        Condition cond = new ConditionFactory.RoleCondition("my_role", Op.EQ)
    6868        assert cond.applies(e)
    6969
    70         cond = new Condition.RoleCondition("another_role", Op.EQ)
     70        cond = new ConditionFactory.RoleCondition("another_role", Op.EQ)
    7171        assert !cond.applies(e)
    7272    }
     
    8080        Environment e = new Environment(n).withParent(r).withIndex(0, r.membersCount).withLinkContext()
    8181
    82         Condition cond = Condition.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false)
     82        Condition cond = ConditionFactory.createKeyValueCondition("role", "my_role", Op.NEQ, Context.LINK, false)
    8383        assert !cond.applies(e)
    8484
    85         cond = Condition.createKeyValueCondition("role", "another_role", Op.NEQ, Context.LINK, false)
     85        cond = ConditionFactory.createKeyValueCondition("role", "another_role", Op.NEQ, Context.LINK, false)
    8686        assert cond.applies(e)
    8787    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy

    r10193 r10837  
    1414import org.openstreetmap.josm.gui.mappaint.Environment
    1515import org.openstreetmap.josm.gui.mappaint.MultiCascade
     16import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.ClassCondition
     17import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyCondition
     18import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyMatchType
     19import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyValueCondition
     20import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op
     21import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.PseudoClassCondition
     22import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.SimpleKeyValueCondition
    1623import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
    1724import org.openstreetmap.josm.tools.ColorHelper
     
    5057    public void testClassCondition() throws Exception {
    5158        def conditions = ((Selector.GeneralSelector) getParser("way[name=X].highway:closed").selector()).conds
    52         assert conditions.get(0) instanceof Condition.SimpleKeyValueCondition
     59        assert conditions.get(0) instanceof SimpleKeyValueCondition
    5360        assert conditions.get(0).applies(getEnvironment("name", "X"))
    54         assert conditions.get(1) instanceof Condition.ClassCondition
    55         assert conditions.get(2) instanceof Condition.PseudoClassCondition
     61        assert conditions.get(1) instanceof ClassCondition
     62        assert conditions.get(2) instanceof PseudoClassCondition
    5663        assert !conditions.get(2).applies(getEnvironment("name", "X"))
    5764    }
     
    93100    @Test
    94101    public void testEqualCondition() throws Exception {
    95         def condition = (Condition.SimpleKeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE)
    96         assert condition instanceof Condition.SimpleKeyValueCondition
     102        def condition = (SimpleKeyValueCondition) getParser("[surface=paved]").condition(Condition.Context.PRIMITIVE)
     103        assert condition instanceof SimpleKeyValueCondition
    97104        assert "surface".equals(condition.k)
    98105        assert "paved".equals(condition.v)
     
    103110    @Test
    104111    public void testNotEqualCondition() throws Exception {
    105         def condition = (Condition.KeyValueCondition) getParser("[surface!=paved]").condition(Condition.Context.PRIMITIVE)
    106         assert Condition.Op.NEQ.equals(condition.op)
     112        def condition = (KeyValueCondition) getParser("[surface!=paved]").condition(Condition.Context.PRIMITIVE)
     113        assert Op.NEQ.equals(condition.op)
    107114        assert !condition.applies(getEnvironment("surface", "paved"))
    108115        assert condition.applies(getEnvironment("surface", "unpaved"))
     
    111118    @Test
    112119    public void testRegexCondition() throws Exception {
    113         def condition = (Condition.KeyValueCondition) getParser("[surface=~/paved|unpaved/]").condition(Condition.Context.PRIMITIVE)
    114         assert Condition.Op.REGEX.equals(condition.op)
     120        def condition = (KeyValueCondition) getParser("[surface=~/paved|unpaved/]").condition(Condition.Context.PRIMITIVE)
     121        assert Op.REGEX.equals(condition.op)
    115122        assert condition.applies(getEnvironment("surface", "unpaved"))
    116123        assert !condition.applies(getEnvironment("surface", "grass"))
     
    119126    @Test
    120127    public void testRegexConditionParenthesis() throws Exception {
    121         def condition = (Condition.KeyValueCondition) getParser("[name =~ /^\\(foo\\)/]").condition(Condition.Context.PRIMITIVE)
     128        def condition = (KeyValueCondition) getParser("[name =~ /^\\(foo\\)/]").condition(Condition.Context.PRIMITIVE)
    122129        assert condition.applies(getEnvironment("name", "(foo)"))
    123130        assert !condition.applies(getEnvironment("name", "foo"))
     
    127134    @Test
    128135    public void testNegatedRegexCondition() throws Exception {
    129         def condition = (Condition.KeyValueCondition) getParser("[surface!~/paved|unpaved/]").condition(Condition.Context.PRIMITIVE)
    130         assert Condition.Op.NREGEX.equals(condition.op)
     136        def condition = (KeyValueCondition) getParser("[surface!~/paved|unpaved/]").condition(Condition.Context.PRIMITIVE)
     137        assert Op.NREGEX.equals(condition.op)
    131138        assert !condition.applies(getEnvironment("surface", "unpaved"))
    132139        assert condition.applies(getEnvironment("surface", "grass"))
     
    135142    @Test
    136143    public void testBeginsEndsWithCondition() throws Exception {
    137         def condition = (Condition.KeyValueCondition) getParser('[foo ^= bar]').condition(Condition.Context.PRIMITIVE)
    138         assert Condition.Op.BEGINS_WITH.equals(condition.op)
     144        def condition = (KeyValueCondition) getParser('[foo ^= bar]').condition(Condition.Context.PRIMITIVE)
     145        assert Op.BEGINS_WITH.equals(condition.op)
    139146        assert condition.applies(getEnvironment("foo", "bar123"))
    140147        assert !condition.applies(getEnvironment("foo", "123bar"))
    141148        assert !condition.applies(getEnvironment("foo", "123bar123"))
    142         condition = (Condition.KeyValueCondition) getParser('[foo $= bar]').condition(Condition.Context.PRIMITIVE)
    143         assert Condition.Op.ENDS_WITH.equals(condition.op)
     149        condition = (KeyValueCondition) getParser('[foo $= bar]').condition(Condition.Context.PRIMITIVE)
     150        assert Op.ENDS_WITH.equals(condition.op)
    144151        assert !condition.applies(getEnvironment("foo", "bar123"))
    145152        assert condition.applies(getEnvironment("foo", "123bar"))
     
    158165    @Test
    159166    public void testStandardKeyCondition() throws Exception {
    160         def c1 = (Condition.KeyCondition) getParser("[ highway ]").condition(Condition.Context.PRIMITIVE)
    161         assert Condition.KeyMatchType.EQ.equals(c1.matchType)
     167        def c1 = (KeyCondition) getParser("[ highway ]").condition(Condition.Context.PRIMITIVE)
     168        assert KeyMatchType.EQ.equals(c1.matchType)
    162169        assert c1.applies(getEnvironment("highway", "unclassified"))
    163170        assert !c1.applies(getEnvironment("railway", "rail"))
    164         def c2 = (Condition.KeyCondition) getParser("[\"/slash/\"]").condition(Condition.Context.PRIMITIVE)
    165         assert Condition.KeyMatchType.EQ.equals(c2.matchType)
     171        def c2 = (KeyCondition) getParser("[\"/slash/\"]").condition(Condition.Context.PRIMITIVE)
     172        assert KeyMatchType.EQ.equals(c2.matchType)
    166173        assert c2.applies(getEnvironment("/slash/", "yes"))
    167174        assert !c2.applies(getEnvironment("\"slash\"", "no"))
     
    170177    @Test
    171178    public void testYesNoKeyCondition() throws Exception {
    172         def c1 = (Condition.KeyCondition) getParser("[oneway?]").condition(Condition.Context.PRIMITIVE)
    173         def c2 = (Condition.KeyCondition) getParser("[oneway?!]").condition(Condition.Context.PRIMITIVE)
    174         def c3 = (Condition.KeyCondition) getParser("[!oneway?]").condition(Condition.Context.PRIMITIVE)
    175         def c4 = (Condition.KeyCondition) getParser("[!oneway?!]").condition(Condition.Context.PRIMITIVE)
     179        def c1 = (KeyCondition) getParser("[oneway?]").condition(Condition.Context.PRIMITIVE)
     180        def c2 = (KeyCondition) getParser("[oneway?!]").condition(Condition.Context.PRIMITIVE)
     181        def c3 = (KeyCondition) getParser("[!oneway?]").condition(Condition.Context.PRIMITIVE)
     182        def c4 = (KeyCondition) getParser("[!oneway?!]").condition(Condition.Context.PRIMITIVE)
    176183        def yes = getEnvironment("oneway", "yes")
    177184        def no = getEnvironment("oneway", "no")
     
    193200    @Test
    194201    public void testRegexKeyCondition() throws Exception {
    195         def c1 = (Condition.KeyCondition) getParser("[/.*:(backward|forward)\$/]").condition(Condition.Context.PRIMITIVE)
    196         assert Condition.KeyMatchType.REGEX.equals(c1.matchType)
     202        def c1 = (KeyCondition) getParser("[/.*:(backward|forward)\$/]").condition(Condition.Context.PRIMITIVE)
     203        assert KeyMatchType.REGEX.equals(c1.matchType)
    197204        assert !c1.applies(getEnvironment("lanes", "3"))
    198205        assert c1.applies(getEnvironment("lanes:forward", "3"))
     
    214221    @Test
    215222    public void testKeyKeyCondition() throws Exception {
    216         def c1 = (Condition.KeyValueCondition) getParser("[foo = *bar]").condition(Condition.Context.PRIMITIVE)
     223        def c1 = (KeyValueCondition) getParser("[foo = *bar]").condition(Condition.Context.PRIMITIVE)
    217224        def w1 = new Way()
    218225        w1.put("foo", "123")
     
    221228        w1.put("bar", "123")
    222229        assert c1.applies(new Environment(w1))
    223         def c2 = (Condition.KeyValueCondition) getParser("[foo =~ */bar/]").condition(Condition.Context.PRIMITIVE)
     230        def c2 = (KeyValueCondition) getParser("[foo =~ */bar/]").condition(Condition.Context.PRIMITIVE)
    224231        def w2 = new Way(w1)
    225232        w2.put("bar", "[0-9]{3}")
Note: See TracChangeset for help on using the changeset viewer.