Changeset 17275 in josm for trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags
- Timestamp:
- 2020-10-28T20:41:00+01:00 (19 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditorTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link MultiValueCellEditor} class. 14 14 */ 15 publicclass MultiValueCellEditorTest {15 class MultiValueCellEditorTest { 16 16 17 17 /** 18 18 * Setup test. 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testMultiValueCellEditor() {28 void testMultiValueCellEditor() { 29 29 assertNotNull(new MultiValueCellEditor().getTableCellEditorComponent(null, new MultiValueResolutionDecision(), false, 0, 0)); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRendererTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 6 7 7 import java.util.Arrays; … … 10 10 import javax.swing.JTable; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.osm.Tag; 15 15 import org.openstreetmap.josm.data.osm.TagCollection; … … 21 21 * Unit tests of {@link MultiValueCellRenderer} class. 22 22 */ 23 publicclass MultiValueCellRendererTest {23 class MultiValueCellRendererTest { 24 24 25 25 /** 26 26 * Setup test. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 34 34 */ 35 35 @Test 36 publicvoid testMultiValueCellRenderer() {36 void testMultiValueCellRenderer() { 37 37 TagConflictResolverModel model = new TagConflictResolverModel(); 38 38 TagCollection tags = new TagCollection(Arrays.asList(new Tag("oneway", "yes"), new Tag("oneway", "no"))); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 8 9 9 import java.awt.Insets; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.extension.RegisterExtension; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 14 14 import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo; … … 22 22 * Unit tests of {@link PasteTagsConflictResolverDialog} class. 23 23 */ 24 publicclass PasteTagsConflictResolverDialogTest {24 class PasteTagsConflictResolverDialogTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testPaneTitles() {37 void testPaneTitles() { 38 38 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES); 39 39 assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE)); … … 46 46 */ 47 47 @Test 48 publicvoid testStatisticsInfoTable() {48 void testStatisticsInfoTable() { 49 49 StatisticsInfo info = new StatisticsInfo(); 50 50 StatisticsTableModel model = new StatisticsTableModel(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModelTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.Arrays; … … 10 10 import java.util.List; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.osm.DataSet; … … 25 25 * Unit tests of {@link RelationMemberConflictResolverModel} class. 26 26 */ 27 publicclass RelationMemberConflictResolverModelTest {27 class RelationMemberConflictResolverModelTest { 28 28 29 29 /** 30 30 * Setup test. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 58 58 59 59 @Test 60 publicvoid testSameRoles() throws Exception {60 void testSameRoles() throws Exception { 61 61 final List<Way> ways = buildTestDataSet(); 62 62 final Relation r = new Relation(); … … 76 76 77 77 @Test 78 publicvoid testDifferentRoles() throws Exception {78 void testDifferentRoles() throws Exception { 79 79 final List<Way> ways = buildTestDataSet(); 80 80 final Relation r = new Relation(); … … 89 89 90 90 @Test 91 publicvoid testDifferentPresence() throws Exception {91 void testDifferentPresence() throws Exception { 92 92 final List<Way> ways = buildTestDataSet(); 93 93 final Relation r = new Relation(); … … 101 101 102 102 @Test 103 publicvoid testEveryMemberIsPresentTwice() throws Exception {103 void testEveryMemberIsPresentTwice() throws Exception { 104 104 final List<Way> ways = buildTestDataSet(); 105 105 final Relation r = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverTest.java
r10962 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link RelationMemberConflictResolver} class. 14 14 */ 15 publicclass RelationMemberConflictResolverTest {15 class RelationMemberConflictResolverTest { 16 16 17 17 /** 18 18 * Setup test. 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 26 26 */ 27 27 @Test 28 publicvoid testRelationMemberConflictResolver() {28 void testRelationMemberConflictResolver() { 29 29 assertNotNull(new RelationMemberConflictResolver(null)); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java
r16164 r17275 2 2 package org.openstreetmap.josm.gui.conflict.tags; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.Arrays; … … 11 12 import java.util.HashSet; 12 13 import java.util.List; 14 import java.util.regex.PatternSyntaxException; 13 15 import java.util.stream.Collectors; 14 16 15 import org.junit. Rule;16 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 17 19 import org.openstreetmap.josm.data.osm.Tag; 18 20 import org.openstreetmap.josm.data.osm.TagCollection; … … 27 29 * Unit tests of {@link TagConflictResolutionUtil} class. 28 30 */ 29 publicclass TagConflictResolutionUtilTest {31 class TagConflictResolutionUtilTest { 30 32 31 33 /** 32 34 * Setup test. 33 35 */ 34 @R ule36 @RegisterExtension 35 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 38 public JOSMTestRules test = new JOSMTestRules(); … … 45 47 */ 46 48 @Test 47 publicvoid testApplyAutomaticTagConflictResolution() {49 void testApplyAutomaticTagConflictResolution() { 48 50 // Check that general tag conflict are not resolved 49 51 TagCollection tc = new TagCollection(); … … 106 108 * Unit tests of {@link AutomaticCombine} class. 107 109 */ 108 publicstatic class AutomaticCombineTest {110 static class AutomaticCombineTest { 109 111 110 112 /** … … 127 129 * Setup test. 128 130 */ 129 @R ule131 @RegisterExtension 130 132 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 131 133 public JOSMTestRules test = new JOSMTestRules(); … … 135 137 */ 136 138 @Test 137 publicvoid testMatchesKeyEmptyKey() {139 void testMatchesKeyEmptyKey() { 138 140 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("", "random description", true, ";", null))) { 139 141 assertFalse(resolver.matchesKey("a")); … … 146 148 */ 147 149 @Test 148 publicvoid testMatchesKeyNotRegex() {150 void testMatchesKeyNotRegex() { 149 151 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine( 150 152 "keyname", "random description", false, "|", null))) { … … 161 163 */ 162 164 @Test 163 publicvoid testMatchesKeyRegex() {165 void testMatchesKeyRegex() { 164 166 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("test[45].*", "", true, ";", "Integer"))) { 165 167 assertFalse(resolver.matchesKey("key")); … … 173 175 */ 174 176 @Test 175 publicvoid testInvalidRegex() {177 void testInvalidRegex() { 176 178 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("invalidregex.(]", "", false, ";", null))) { 177 179 // Should not raise exception if the resolver.isRexEx == false: … … 188 190 * Unit test of {@link AutomaticCombine} with invalid regex. 189 191 */ 190 @Test (expected = java.util.regex.PatternSyntaxException.class)191 publicvoid testInvalidRegexExceptionDefaultConstructed() {192 @Test 193 void testInvalidRegexExceptionDefaultConstructed() { 192 194 AutomaticCombine resolver = new AutomaticCombine("AB.(]", "", true, ";", null); 193 resolver.matchesKey("AB"); 194 } 195 195 assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB")); 196 } 196 197 197 198 /** 198 199 * Unit test of {@link AutomaticCombine} with invalid regex. 199 200 */ 200 @Test (expected = java.util.regex.PatternSyntaxException.class)201 publicvoid testInvalidRegexExceptionFullyConstructed() {201 @Test 202 void testInvalidRegexExceptionFullyConstructed() { 202 203 AutomaticCombine resolver = new AutomaticCombine(); 203 204 resolver.key = "AB.(]"; 204 205 resolver.isRegex = true; 205 resolver.matchesKey("AB");206 assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB")); 206 207 } 207 208 … … 210 211 */ 211 212 @Test 212 publicvoid testResolve() {213 void testResolve() { 213 214 for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("random", "", true, "|", "String"))) { 214 215 assertEquals(resolver.resolve(newHashSet("value1", "value2")), "value1|value2"); … … 230 231 * Unit tests of {@link AutomaticChoice} class. 231 232 */ 232 publicstatic class AutomaticChoiceTest {233 static class AutomaticChoiceTest { 233 234 /** 234 235 * Setup test. 235 236 */ 236 @R ule237 @RegisterExtension 237 238 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 238 239 public JOSMTestRules test = new JOSMTestRules(); … … 260 261 */ 261 262 @Test 262 publicvoid testMatchesValue() {263 void testMatchesValue() { 263 264 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 264 265 "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) { … … 282 283 */ 283 284 @Test 284 publicvoid testComputeScoreFromValue() {285 void testComputeScoreFromValue() { 285 286 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 286 287 "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) { … … 298 299 */ 299 300 @Test 300 publicvoid testInvalidRegex() {301 void testInvalidRegex() { 301 302 for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice( 302 303 "k", "g", "", false, "invalidregex.(]", "InvalidScore$0\\1$-4"))) { … … 316 317 * Unit test of {@link AutomaticChoice} when invalid regex is used. 317 318 */ 318 @Test (expected = java.util.regex.PatternSyntaxException.class)319 publicvoid testMatchesValueInvalidRegex() {319 @Test 320 void testMatchesValueInvalidRegex() { 320 321 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "InvalidScore$0\\1$-4"); 321 resolver.matchesValue("test");322 assertThrows(PatternSyntaxException.class, () -> resolver.matchesValue("test")); 322 323 } 323 324 … … 325 326 * Unit test of {@link AutomaticChoice} when invalid regex is used. 326 327 */ 327 @Test (expected = java.util.regex.PatternSyntaxException.class)328 publicvoid testComputeScoreFromValueInvalidRegex() {328 @Test 329 void testComputeScoreFromValueInvalidRegex() { 329 330 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "valid"); 330 resolver.computeScoreFromValue("valid"); 331 } 332 331 assertThrows(PatternSyntaxException.class, () -> resolver.computeScoreFromValue("valid")); 332 } 333 333 334 334 /** … … 336 336 */ 337 337 @Test 338 publicvoid testComputeScoreFromValueInvalidReplacement() {338 void testComputeScoreFromValueInvalidReplacement() { 339 339 AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "valid", "InvalidScore$0\\1$-4"); 340 340 boolean exceptionThrown = false; … … 351 351 * Unit tests of {@link AutomaticChoiceGroup} class. 352 352 */ 353 publicstatic class AutomaticChoiceGroupTest {353 static class AutomaticChoiceGroupTest { 354 354 /** 355 355 * Setup test. 356 356 */ 357 @R ule357 @RegisterExtension 358 358 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 359 359 public JOSMTestRules test = new JOSMTestRules(); … … 373 373 */ 374 374 @Test 375 publicvoid testGroupChoices() {375 void testGroupChoices() { 376 376 Collection<AutomaticChoiceGroup> groups = AutomaticChoiceGroup.groupChoices(Arrays.asList(choiceKey1Group1, choiceKey1Group2)); 377 377 assertEquals(2, groups.size()); … … 405 405 */ 406 406 @Test 407 publicvoid testMatchesKey() {407 void testMatchesKey() { 408 408 AutomaticChoiceGroup group = new AutomaticChoiceGroup( 409 409 choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex, … … 427 427 */ 428 428 @Test 429 publicvoid testResolve() {429 void testResolve() { 430 430 AutomaticChoiceGroup group = new AutomaticChoiceGroup( 431 431 choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex,
Note: See TracChangeset
for help on using the changeset viewer.