Last change
on this file since 14125 was 14125, checked in by Don-vip, 6 years ago |
see #15229 - extract lifecycle Main classes to a new lifecycle SPI
|
-
Property svn:eol-style
set to
native
|
File size:
1.5 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.spi.lifecycle;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertFalse;
|
---|
5 | import static org.junit.Assert.assertTrue;
|
---|
6 |
|
---|
7 | import org.junit.Rule;
|
---|
8 | import org.junit.Test;
|
---|
9 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
10 |
|
---|
11 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Unit tests of {@link Lifecycle} class.
|
---|
15 | */
|
---|
16 | public class LifecycleTest {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Setup test.
|
---|
20 | */
|
---|
21 | @Rule
|
---|
22 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
23 | public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection();
|
---|
24 |
|
---|
25 | private static class InitStatusListenerStub implements InitStatusListener {
|
---|
26 |
|
---|
27 | boolean updated;
|
---|
28 | boolean finished;
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public Object updateStatus(String event) {
|
---|
32 | updated = true;
|
---|
33 | return null;
|
---|
34 | }
|
---|
35 |
|
---|
36 | @Override
|
---|
37 | public void finish(Object status) {
|
---|
38 | finished = true;
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Unit test of {@link Lifecycle#setInitStatusListener}.
|
---|
44 | */
|
---|
45 | @Test
|
---|
46 | public void testSetInitStatusListener() {
|
---|
47 | InitStatusListenerStub listener = new InitStatusListenerStub();
|
---|
48 | Lifecycle.setInitStatusListener(listener);
|
---|
49 | assertFalse(listener.updated);
|
---|
50 | assertFalse(listener.finished);
|
---|
51 | new InitializationTask("", () -> { }).call();
|
---|
52 | assertTrue(listener.updated);
|
---|
53 | assertTrue(listener.finished);
|
---|
54 | }
|
---|
55 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.