source: josm/trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCommentModelTest.java @ 13109

Last change on this file since 13109 was 13109, checked in by Don-vip, 16 months ago

fix #15537 - Support changeset hashtags (hashtags changeset tag, extracted from comment at upload, or set by remote control through new changeset_hashtags parameter)

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.io;
3
4import static org.junit.Assert.assertEquals;
5
6import java.util.Arrays;
7import java.util.Collections;
8
9import org.junit.Rule;
10import org.junit.Test;
11import org.openstreetmap.josm.testutils.JOSMTestRules;
12
13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14
15/**
16 * Unit tests of {@link ChangesetCommentModel} class.
17 */
18public class ChangesetCommentModelTest {
19
20    /**
21     * Setup tests
22     */
23    @Rule
24    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
25    public JOSMTestRules test = new JOSMTestRules();
26
27    /**
28     * Test of {@link ChangesetCommentModel#findHashTags}.
29     */
30    @Test
31    public void testFindHashTags() {
32        ChangesetCommentModel model = new ChangesetCommentModel();
33        assertEquals(Collections.emptyList(), model.findHashTags());
34        model.setComment(" ");
35        assertEquals(Collections.emptyList(), model.findHashTags());
36        model.setComment(" #");
37        assertEquals(Collections.emptyList(), model.findHashTags());
38        model.setComment(" # ");
39        assertEquals(Collections.emptyList(), model.findHashTags());
40        model.setComment(" https://example.com/#map ");
41        assertEquals(Collections.emptyList(), model.findHashTags());
42        model.setComment(" #foo ");
43        assertEquals(Arrays.asList("#foo"), model.findHashTags());
44        model.setComment(" #foo #bar baz");
45        assertEquals(Arrays.asList("#foo", "#bar"), model.findHashTags());
46    }
47}
Note: See TracBrowser for help on using the repository browser.