source: josm/trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java@ 18893

Last change on this file since 18893 was 18893, checked in by taylor.smock, 7 months ago

Fix #16567: Upgrade to JUnit 5

JOSMTestRules and JOSMTestFixture can reset the default JOSM profile, which can
be unexpected for new contributors. This updates all tests to use JUnit 5 and
the new JUnit 5 annotations.

This also renames MapCSSStyleSourceFilterTest to MapCSSStyleSourceFilterPerformanceTest
to match the naming convention for performance tests and fixes some lint issues.

This was tested by running all tests individually and together.

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.spi.lifecycle;
3
4import static org.junit.jupiter.api.Assertions.assertFalse;
5import static org.junit.jupiter.api.Assertions.assertTrue;
6
7import org.junit.jupiter.api.Test;
8import org.openstreetmap.josm.testutils.annotations.HTTPS;
9import org.openstreetmap.josm.testutils.annotations.Main;
10import org.openstreetmap.josm.testutils.annotations.OsmApi;
11import 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
20class LifecycleTest {
21 private static 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.