Changeset 15051 in josm for trunk/test/unit


Ignore:
Timestamp:
2019-05-05T17:35:29+02:00 (6 years ago)
Author:
Don-vip
Message:

see #17634 - allow to define exceptions to the list of forbidden terms, through upload.comment.exception-terms property

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadDialogTest.java

    r15015 r15051  
    265265        Config.getPref().putList(prefix + ".mandatory-terms", null);
    266266        Config.getPref().putList(prefix + ".forbidden-terms", null);
    267         assertNull(UploadAction.validateUploadTag("foo", prefix, def, def));
     267        assertNull(UploadAction.validateUploadTag("foo", prefix, def, def, def));
    268268
    269269        Config.getPref().putList(prefix + ".mandatory-terms", Arrays.asList("foo"));
    270         assertNull(UploadAction.validateUploadTag("foo", prefix, def, def));
     270        assertNull(UploadAction.validateUploadTag("foo", prefix, def, def, def));
    271271        assertEquals("The following required terms are missing: [foo]",
    272                 UploadAction.validateUploadTag("bar", prefix, def, def));
     272                UploadAction.validateUploadTag("bar", prefix, def, def, def));
    273273
    274274        Config.getPref().putList(prefix + ".forbidden-terms", Arrays.asList("bar"));
    275         assertNull(UploadAction.validateUploadTag("foo", prefix, def, def));
    276         assertEquals("The following forbidden terms have been found: [bar]",
    277                 UploadAction.validateUploadTag("foobar", prefix, def, def));
    278         assertEquals("The following forbidden terms have been found: [bar]",
    279                 UploadAction.validateUploadTag("FOOBAR", prefix, def, def));
     275        assertNull(UploadAction.validateUploadTag("foo", prefix, def, def, def));
     276        assertEquals("The following forbidden terms have been found: [bar]",
     277                UploadAction.validateUploadTag("foobar", prefix, def, def, def));
     278        assertEquals("The following forbidden terms have been found: [bar]",
     279                UploadAction.validateUploadTag("FOOBAR", prefix, def, def, def));
     280
     281        Config.getPref().putList(prefix + ".exception-terms", Arrays.asList("barosm"));
     282        assertEquals("The following forbidden terms have been found: [bar]",
     283                UploadAction.validateUploadTag("foobar", prefix, def, def, def));
     284        assertEquals("The following forbidden terms have been found: [bar]",
     285                UploadAction.validateUploadTag("FOOBAR", prefix, def, def, def));
     286        assertNull(UploadAction.validateUploadTag("foobarosm", prefix, def, def, def));
     287        assertNull(UploadAction.validateUploadTag("FOOBAROSM", prefix, def, def, def));
    280288    }
    281289
Note: See TracChangeset for help on using the changeset viewer.