Changeset 18839 in josm for trunk/test/unit/org
- Timestamp:
- 2023-09-21T19:04:05+02:00 (14 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/NotesDialogTest.java
r18454 r18839 9 9 10 10 import java.time.Instant; 11 import java.util.Arrays; 11 12 import java.util.Collections; 13 import java.util.List; 14 import java.util.stream.Stream; 12 15 13 16 import javax.swing.JLabel; … … 16 19 import org.junit.jupiter.api.Test; 17 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 import org.junit.jupiter.params.ParameterizedTest; 22 import org.junit.jupiter.params.provider.Arguments; 23 import org.junit.jupiter.params.provider.MethodSource; 18 24 import org.junit.platform.commons.util.ReflectionUtils; 19 25 import org.openstreetmap.josm.TestUtils; … … 21 27 import org.openstreetmap.josm.data.notes.Note; 22 28 import org.openstreetmap.josm.data.notes.NoteComment; 29 import org.openstreetmap.josm.data.osm.Changeset; 30 import org.openstreetmap.josm.data.osm.ChangesetCache; 23 31 import org.openstreetmap.josm.data.osm.User; 24 32 import org.openstreetmap.josm.gui.ExtendedDialog; … … 27 35 import org.openstreetmap.josm.gui.layer.NoteLayer; 28 36 import org.openstreetmap.josm.gui.widgets.JosmTextField; 37 import org.openstreetmap.josm.spi.preferences.Config; 29 38 import org.openstreetmap.josm.testutils.JOSMTestRules; 30 39 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; … … 97 106 assertDoesNotThrow(() -> closeAction.actionPerformed(null)); 98 107 } 108 109 static Stream<Arguments> testCloseActionGetRelatedChangesetUrls() { 110 return Stream.of( 111 Arguments.of(1, 0, Collections.singletonList("/note/123")), 112 Arguments.of(1, 0, Collections.singletonList("/note/231")), 113 Arguments.of(1, 1, Collections.singletonList("/note/1")), 114 Arguments.of(1, 2, Arrays.asList("/note/1", "/note/1 again")), 115 Arguments.of(1, 2, Arrays.asList("/note/1", "/note/1 again", "/note/12 here")), 116 Arguments.of(1, 2, Arrays.asList("/note/1", "/note/12 again", "/note/1 here")), 117 Arguments.of(1, 2, Arrays.asList("/note/12", "/note/1 again", "/note/1 here")), 118 Arguments.of(1, 3, Arrays.asList("/note/1", "/note/1 again", "/note/1 here")), 119 Arguments.of(1, 3, Arrays.asList("note 1", "note 1 again", "note 1 here")) 120 ); 121 } 122 123 @ParameterizedTest 124 @MethodSource 125 void testCloseActionGetRelatedChangesetUrls(long noteId, int expectedChangesets, List<String> changesetComments) { 126 try { 127 Config.getPref().put("osm-server.url", null); 128 final String[] apiList = {"osm.org", "openstreetmap.org", Config.getUrls().getBaseBrowseUrl()}; 129 for (int i = 0; i < changesetComments.size(); i++) { 130 final String comment = changesetComments.get(i); 131 final Changeset cs = new Changeset(i + 1); 132 cs.put("comment", apiList[i % 3] + comment); 133 ChangesetCache.getInstance().update(cs); 134 } 135 final List<String> changesetUrls = NotesDialog.getRelatedChangesetUrls(noteId); 136 assertEquals(expectedChangesets, changesetUrls.size()); 137 } finally { 138 ChangesetCache.getInstance().clear(); 139 } 140 } 99 141 } -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/DeleteLayerActionTest.java
r18837 r18839 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.gui.dialogs.layer; 2 3
Note:
See TracChangeset
for help on using the changeset viewer.