1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.changeset;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertNotNull;
|
---|
5 |
|
---|
6 | import java.util.Collections;
|
---|
7 | import java.util.List;
|
---|
8 |
|
---|
9 | import org.junit.Rule;
|
---|
10 | import org.junit.Test;
|
---|
11 | import org.openstreetmap.josm.data.osm.Changeset;
|
---|
12 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.CancelAction;
|
---|
13 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.ChangesetDetailViewSynchronizer;
|
---|
14 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.CloseSelectedChangesetsAction;
|
---|
15 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.DownloadMyChangesets;
|
---|
16 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.DownloadSelectedChangesetContentAction;
|
---|
17 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.DownloadSelectedChangesetsAction;
|
---|
18 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.QueryAction;
|
---|
19 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.RemoveFromCacheAction;
|
---|
20 | import org.openstreetmap.josm.gui.dialogs.changeset.ChangesetCacheManager.ShowDetailAction;
|
---|
21 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
22 |
|
---|
23 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Unit tests of {@link ChangesetCacheManager} class.
|
---|
27 | */
|
---|
28 | public class ChangesetCacheManagerTest {
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Setup tests
|
---|
32 | */
|
---|
33 | @Rule
|
---|
34 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
35 | public JOSMTestRules test = new JOSMTestRules().preferences().platform();
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * Unit test of {@link ChangesetCacheManager#destroyInstance}.
|
---|
39 | */
|
---|
40 | @Test
|
---|
41 | public void testDestroyInstance() {
|
---|
42 | ChangesetCacheManager.destroyInstance();
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Unit test of {@link ChangesetCacheManager#buildButtonPanel},
|
---|
47 | * {@link ChangesetCacheManager#buildToolbarPanel}.
|
---|
48 | * {@link ChangesetCacheManager#buildModel}.
|
---|
49 | */
|
---|
50 | @Test
|
---|
51 | public void testBuild() {
|
---|
52 | assertNotNull(ChangesetCacheManager.buildButtonPanel());
|
---|
53 | assertNotNull(ChangesetCacheManager.buildToolbarPanel());
|
---|
54 | assertNotNull(ChangesetCacheManager.buildModel());
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Unit test of {@link ChangesetCacheManager.ChangesetDetailViewSynchronizer} class.
|
---|
59 | */
|
---|
60 | @Test
|
---|
61 | public void testChangesetDetailViewSynchronizer() {
|
---|
62 | new ChangesetDetailViewSynchronizer(new ChangesetCacheManagerModel(null) {
|
---|
63 | @Override
|
---|
64 | public List<Changeset> getSelectedChangesets() {
|
---|
65 | return Collections.emptyList();
|
---|
66 | }
|
---|
67 | }).valueChanged(null);
|
---|
68 |
|
---|
69 | new ChangesetDetailViewSynchronizer(new ChangesetCacheManagerModel(null) {
|
---|
70 | @Override
|
---|
71 | public List<Changeset> getSelectedChangesets() {
|
---|
72 | return Collections.singletonList(new Changeset());
|
---|
73 | }
|
---|
74 | }).valueChanged(null);
|
---|
75 | }
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Unit test of {@link ChangesetCacheManager.CancelAction} class.
|
---|
79 | */
|
---|
80 | @Test
|
---|
81 | public void testCancelAction() {
|
---|
82 | new CancelAction().actionPerformed(null);
|
---|
83 | }
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Unit test of {@link ChangesetCacheManager.CloseSelectedChangesetsAction} class.
|
---|
87 | */
|
---|
88 | @Test
|
---|
89 | public void testCloseSelectedChangesetsAction() {
|
---|
90 | CloseSelectedChangesetsAction action = new CloseSelectedChangesetsAction(new ChangesetCacheManagerModel(null) {
|
---|
91 | @Override
|
---|
92 | public List<Changeset> getSelectedChangesets() {
|
---|
93 | return Collections.singletonList(new Changeset());
|
---|
94 | }
|
---|
95 | });
|
---|
96 | action.valueChanged(null);
|
---|
97 | action.actionPerformed(null);
|
---|
98 | }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Unit test of {@link ChangesetCacheManager.DownloadMyChangesets} class.
|
---|
102 | */
|
---|
103 | @Test
|
---|
104 | public void testDownloadMyChangesets() {
|
---|
105 | new DownloadMyChangesets().actionPerformed(null);
|
---|
106 | }
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * Unit test of {@link ChangesetCacheManager.DownloadSelectedChangesetContentAction} class.
|
---|
110 | */
|
---|
111 | @Test
|
---|
112 | public void testDownloadSelectedChangesetContentAction() {
|
---|
113 | DownloadSelectedChangesetContentAction action = new DownloadSelectedChangesetContentAction(ChangesetCacheManager.buildModel());
|
---|
114 | action.valueChanged(null);
|
---|
115 | action.actionPerformed(null);
|
---|
116 | }
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Unit test of {@link ChangesetCacheManager.DownloadSelectedChangesetsAction} class.
|
---|
120 | */
|
---|
121 | @Test
|
---|
122 | public void testDownloadSelectedChangesetsAction() {
|
---|
123 | DownloadSelectedChangesetsAction action = new DownloadSelectedChangesetsAction(ChangesetCacheManager.buildModel());
|
---|
124 | action.valueChanged(null);
|
---|
125 | action.actionPerformed(null);
|
---|
126 | }
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * Unit test of {@link ChangesetCacheManager.QueryAction} class.
|
---|
130 | */
|
---|
131 | @Test
|
---|
132 | public void testQueryAction() {
|
---|
133 | new QueryAction().actionPerformed(null);
|
---|
134 | }
|
---|
135 |
|
---|
136 | /**
|
---|
137 | * Unit test of {@link ChangesetCacheManager.RemoveFromCacheAction} class.
|
---|
138 | */
|
---|
139 | @Test
|
---|
140 | public void testRemoveFromCacheAction() {
|
---|
141 | RemoveFromCacheAction action = new RemoveFromCacheAction(ChangesetCacheManager.buildModel());
|
---|
142 | action.valueChanged(null);
|
---|
143 | action.actionPerformed(null);
|
---|
144 | }
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * Unit test of {@link ChangesetCacheManager.ShowDetailAction} class.
|
---|
148 | */
|
---|
149 | @Test
|
---|
150 | public void testShowDetailAction() {
|
---|
151 | new ShowDetailAction(ChangesetCacheManager.buildModel()).actionPerformed(null);
|
---|
152 | }
|
---|
153 | }
|
---|