Changeset 14100 in josm for trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
- Timestamp:
- 2018-08-06T00:26:16+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r13920 r14100 14 14 import java.util.Collection; 15 15 import java.util.Collections; 16 16 import java.util.Set; 17 18 import org.junit.Assert; 17 19 import org.junit.Rule; 18 20 import org.junit.Test; … … 39 41 import org.openstreetmap.josm.gui.tagging.presets.items.Key; 40 42 import org.openstreetmap.josm.testutils.JOSMTestRules; 43 import org.openstreetmap.josm.tools.Logging; 41 44 import org.openstreetmap.josm.tools.date.DateUtils; 42 45 43 46 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 47 import nl.jqno.equalsverifier.EqualsVerifier; 48 import nl.jqno.equalsverifier.Warning; 44 49 45 50 /** … … 701 706 } 702 707 } 708 709 /** 710 * Unit test of methods {@link Match#equals} and {@link Match#hashCode}, including all subclasses. 711 */ 712 @Test 713 public void testEqualsContract() { 714 TestUtils.assumeWorkingEqualsVerifier(); 715 Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class); 716 Assert.assertTrue(matchers.size() >= 10); // if it finds less than 10 classes, something is broken 717 for (Class<?> c : matchers) { 718 Logging.debug(c.toString()); 719 EqualsVerifier.forClass(c).usingGetClass() 720 .suppress(Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT) 721 .withPrefabValues(TaggingPreset.class, newTaggingPreset("foo"), newTaggingPreset("bar")) 722 .verify(); 723 } 724 } 725 726 private static TaggingPreset newTaggingPreset(String name) { 727 TaggingPreset result = new TaggingPreset(); 728 result.name = name; 729 return result; 730 } 703 731 }
Note:
See TracChangeset
for help on using the changeset viewer.