Changeset 18475 in josm for trunk/test
- Timestamp:
- 2022-06-08T19:09:15+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/Tag2LinkTest.java
r18037 r18475 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.tools; 3 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 3 6 4 7 import java.util.ArrayList; … … 6 9 import java.util.List; 7 10 8 import org.junit.Assert;9 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.params.ParameterizedTest; 13 import org.junit.jupiter.params.provider.ValueSource; 10 14 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 11 15 … … 23 27 24 28 void checkLinks(String... expected) { 25 Assert.assertEquals(Arrays.asList(expected), links);29 assertEquals(Arrays.asList(expected), this.links); 26 30 } 27 31 … … 32 36 void testInitialize() { 33 37 Tag2Link.initialize(); 34 Assert.assertTrue("obtains at least 40 rules", Tag2Link.wikidataRules.size() > 40); 38 assertTrue(Tag2Link.wikidataRules.size() > 40, "obtains at least 40 rules"); 39 } 40 41 /** 42 * Unit test for links that may come in multiple forms. 43 * Example: <a href="https://wiki.osm.org/wiki/Key:contact:facebook">https://wiki.openstreetmap.org/wiki/Key:contact:facebook</a> 44 * 45 * See also JOSM #21794 46 * @param value The tag value for "contact:facebook" 47 */ 48 @ParameterizedTest 49 @ValueSource(strings = {"https://www.facebook.com/FacebookUserName", "FacebookUserName"}) 50 void testUrlKeyMultipleForms(final String value) { 51 // We need the wikidata rules Since testInitialize tests initialization, reuse it. 52 if (!Tag2Link.wikidataRules.containsKey("contact:facebook")) { 53 this.testInitialize(); 54 } 55 Tag2Link.getLinksForTag("contact:facebook", value, this::addLink); 56 this.checkLinks("Open unavatar.now.sh // https://unavatar.now.sh/facebook/FacebookUserName", 57 "Open facebook.com // https://www.facebook.com/FacebookUserName", 58 "Open messenger.com // https://www.messenger.com/t/FacebookUserName"); 35 59 } 36 60
Note:
See TracChangeset
for help on using the changeset viewer.