source: josm/trunk/test/unit/org/openstreetmap/josm/testutils/annotations/LayerManager.java@ 18972

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

See #23465: Add additional javadoc comments

This also fixes some sonarlint issues

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.testutils.annotations;
3
4import java.lang.annotation.ElementType;
5import java.lang.annotation.Retention;
6import java.lang.annotation.RetentionPolicy;
7import java.lang.annotation.Target;
8
9import org.junit.jupiter.api.extension.AfterEachCallback;
10import org.junit.jupiter.api.extension.BeforeEachCallback;
11import org.junit.jupiter.api.extension.ExtendWith;
12import org.junit.jupiter.api.extension.ExtensionContext;
13import org.openstreetmap.josm.testutils.JOSMTestRules;
14
15/**
16 * Clear the main {@link org.openstreetmap.josm.gui.layer.LayerManager} between tests.
17 * <br />
18 * You shouldn't have to register this -- it should be run automatically by the JUnit 5 test environment.
19 * See <a href="https://junit.org/junit5/docs/current/user-guide/#extensions-registration-automatic">
20 * Automatic Extension Registration
21 * </a> for more information.
22 */
23@Target({ElementType.TYPE, ElementType.METHOD})
24@Retention(RetentionPolicy.RUNTIME)
25@ExtendWith(LayerManager.LayerManagerExtension.class)
26public @interface LayerManager {
27 /**
28 * Clean the layer environment
29 */
30 class LayerManagerExtension implements BeforeEachCallback, AfterEachCallback {
31 @Override
32 public void afterEach(ExtensionContext context) {
33 JOSMTestRules.cleanLayerEnvironment();
34 }
35
36 @Override
37 public void beforeEach(ExtensionContext context) {
38 this.afterEach(context);
39 }
40 }
41}
Note: See TracBrowser for help on using the repository browser.