Changeset 18847 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2023-10-03T16:25:42+02:00 (15 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r18690 r18847 22 22 import org.junit.jupiter.api.Timeout; 23 23 import org.junit.jupiter.params.ParameterizedTest; 24 import org.junit.jupiter.params.provider.MethodSource; 24 25 import org.junit.jupiter.params.provider.ValueSource; 25 26 import org.openstreetmap.josm.TestUtils; … … 45 46 import org.openstreetmap.josm.gui.tagging.presets.items.Key; 46 47 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 47 import org.openstreetmap.josm.tools.Logging;48 48 49 49 import nl.jqno.equalsverifier.EqualsVerifier; … … 745 745 } 746 746 747 static Set<Class<? extends Match>> testEqualsContract() { 748 TestUtils.assumeWorkingEqualsVerifier(); 749 final Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class); 750 assertTrue(matchers.size() >= 10, "There should be at least 10 matchers from JOSM core"); 751 return matchers; 752 } 753 747 754 /** 748 755 * Unit test of methods {@link Match#equals} and {@link Match#hashCode}, including all subclasses. 749 */ 750 @Test 751 void testEqualsContract() { 752 TestUtils.assumeWorkingEqualsVerifier(); 753 Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class); 754 assertTrue(matchers.size() >= 10); // if it finds less than 10 classes, something is broken 755 for (Class<?> c : matchers) { 756 Logging.debug(c.toString()); 757 EqualsVerifier.forClass(c).usingGetClass() 758 .suppress(Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT) 759 .withPrefabValues(TaggingPreset.class, newTaggingPreset("foo"), newTaggingPreset("bar")) 760 .verify(); 761 } 756 * @param clazz The class to test 757 */ 758 @ParameterizedTest 759 @MethodSource 760 void testEqualsContract(Class<? extends Match> clazz) { 761 EqualsVerifier.forClass(clazz).usingGetClass() 762 .suppress(Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT) 763 .withPrefabValues(TaggingPreset.class, newTaggingPreset("foo"), newTaggingPreset("bar")) 764 .verify(); 762 765 } 763 766 -
trunk/test/unit/org/openstreetmap/josm/tools/SearchCompilerQueryWizardTest.java
r17988 r18847 7 7 import org.junit.jupiter.api.Disabled; 8 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 9 import org.openstreetmap.josm.testutils.annotations.I18n; 13 10 14 11 /** 15 12 * Unit tests of {@link SearchCompilerQueryWizard} class. 16 13 */ 14 @I18n("de") 17 15 class SearchCompilerQueryWizardTest { 18 /**19 * Base test environment is enough20 */21 @RegisterExtension22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")23 public JOSMTestRules test = new JOSMTestRules().i18n("de");24 25 16 private static String constructQuery(String s) { 26 17 return SearchCompilerQueryWizard.constructQuery(s); … … 264 255 "type:node AND (*=forward OR *=backward)"); 265 256 } 257 258 /** 259 * Test for ticket <a href="https://josm.openstreetmap.de/ticket/23212>#23212</a>. 260 * {@code key:} search should become {@code nwr["key"]} 261 */ 262 @Test 263 void testTicket23212() { 264 assertQueryEquals(" nwr[\"name\"];\n", "name:"); 265 } 266 266 }
Note:
See TracChangeset
for help on using the changeset viewer.