Changeset 18823 in josm for trunk/test/unit
- Timestamp:
- 2023-09-06T22:04:23+02:00 (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelectorTest.java
r17275 r18823 2 2 package org.openstreetmap.josm.gui.tagging.presets; 3 3 4 import static org.junit.jupiter.api.Assertions.assert Equals;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit.jupiter.api.extension.RegisterExtension; 7 import java.util.Collections; 8 8 9 import org.junit.jupiter.api.Test; 9 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector.PresetClassification;10 import org.openstreetmap.josm.testutils.JOSMTestRules;11 12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;13 10 14 11 /** … … 16 13 */ 17 14 class TaggingPresetSelectorTest { 18 19 15 /** 20 * Setup rule 21 */ 22 @RegisterExtension 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 public JOSMTestRules test = new JOSMTestRules(); 25 26 /** 27 * Unit test for {@link PresetClassification#isMatching}. 16 * Unit test for {@link TaggingPresetSelector.PresetClassifications#getMatchingPresets}. 28 17 */ 29 18 @Test 30 void test IsMatching() {19 void testGetMatching() { 31 20 TaggingPreset preset = new TaggingPreset(); 32 21 preset.name = "estação de bombeiros"; // fire_station in brazilian portuguese 33 PresetClassification pc = new PresetClassification(preset); 34 assertEquals(0, pc.isMatchingName("foo")); 35 assertTrue(pc.isMatchingName("estação") > 0); 36 assertTrue(pc.isMatchingName("estacao") > 0); 22 TaggingPresetSelector.PresetClassifications presetClassifications = new TaggingPresetSelector.PresetClassifications(); 23 presetClassifications.loadPresets(Collections.singleton(preset)); 24 assertTrue(presetClassifications.getMatchingPresets(null, new String[] {"foo"}, false, 25 false, null, null).isEmpty()); 26 assertSame(preset, presetClassifications.getMatchingPresets(null, new String[] {"estação"}, false, 27 false, null, null).get(0).preset); 28 assertSame(preset, presetClassifications.getMatchingPresets(null, new String[] {"estacao"}, false, 29 false, null, null).get(0).preset); 37 30 } 38 31 }
Note:
See TracChangeset
for help on using the changeset viewer.