Last change
on this file was 19050, checked in by taylor.smock, 18 hours ago |
Revert most var changes from r19048, fix most new compile warnings and checkstyle issues
Also, document why various ErrorProne checks were originally disabled and fix
generic SonarLint issues.
|
-
Property svn:eol-style
set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.spi.lifecycle;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
---|
5 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
---|
6 |
|
---|
7 | import org.junit.jupiter.api.Test;
|
---|
8 | import org.openstreetmap.josm.testutils.annotations.HTTPS;
|
---|
9 | import org.openstreetmap.josm.testutils.annotations.Main;
|
---|
10 | import org.openstreetmap.josm.testutils.annotations.OsmApi;
|
---|
11 | import org.openstreetmap.josm.testutils.annotations.Projection;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Unit tests of {@link Lifecycle} class.
|
---|
15 | */
|
---|
16 | @HTTPS
|
---|
17 | @Main
|
---|
18 | @OsmApi(OsmApi.APIType.DEV)
|
---|
19 | @Projection
|
---|
20 | class LifecycleTest {
|
---|
21 | private static final class InitStatusListenerStub implements InitStatusListener {
|
---|
22 |
|
---|
23 | boolean updated;
|
---|
24 | boolean finished;
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public Object updateStatus(String event) {
|
---|
28 | updated = true;
|
---|
29 | return null;
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public void finish(Object status) {
|
---|
34 | finished = true;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Unit test of {@link Lifecycle#setInitStatusListener}.
|
---|
40 | */
|
---|
41 | @Test
|
---|
42 | void testSetInitStatusListener() {
|
---|
43 | InitStatusListenerStub listener = new InitStatusListenerStub();
|
---|
44 | Lifecycle.setInitStatusListener(listener);
|
---|
45 | assertFalse(listener.updated);
|
---|
46 | assertFalse(listener.finished);
|
---|
47 | new InitializationTask("", () -> { }).call();
|
---|
48 | assertTrue(listener.updated);
|
---|
49 | assertTrue(listener.finished);
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.