1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.tagging.ac;
|
---|
3 |
|
---|
4 | import org.junit.Rule;
|
---|
5 | import org.junit.Test;
|
---|
6 | import org.openstreetmap.josm.TestUtils;
|
---|
7 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
8 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
9 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
10 | import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager.UserInputTag;
|
---|
11 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
12 |
|
---|
13 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
14 | import nl.jqno.equalsverifier.EqualsVerifier;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link AutoCompletionManager} class.
|
---|
18 | */
|
---|
19 | public class AutoCompletionManagerTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Setup rule
|
---|
23 | */
|
---|
24 | @Rule
|
---|
25 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
26 | public JOSMTestRules test = new JOSMTestRules();
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/17064">#17064</a>.
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | public void testTicket17064() {
|
---|
33 | DataSet ds = new DataSet();
|
---|
34 | OsmDataLayer layer = new OsmDataLayer(ds, "testTicket17064", null);
|
---|
35 | MainApplication.getLayerManager().addLayer(layer);
|
---|
36 | AutoCompletionManager.of(ds);
|
---|
37 | MainApplication.getLayerManager().removeLayer(layer); // NPE in #17064
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Unit test of methods {@link UserInputTag#equals} and {@link UserInputTag#hashCode}.
|
---|
42 | */
|
---|
43 | @Test
|
---|
44 | public void testEqualsContract() {
|
---|
45 | TestUtils.assumeWorkingEqualsVerifier();
|
---|
46 | EqualsVerifier.forClass(UserInputTag.class).usingGetClass()
|
---|
47 | .verify();
|
---|
48 | }
|
---|
49 | }
|
---|