1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertEquals;
|
---|
5 | import static org.junit.Assert.assertFalse;
|
---|
6 | import static org.junit.Assert.assertNotNull;
|
---|
7 | import static org.junit.Assert.assertTrue;
|
---|
8 |
|
---|
9 | import org.junit.BeforeClass;
|
---|
10 | import org.junit.Test;
|
---|
11 | import org.openstreetmap.josm.JOSMFixture;
|
---|
12 | import org.openstreetmap.josm.Main;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Unit tests of {@link ValidatorLayer} class.
|
---|
16 | */
|
---|
17 | public class ValidatorLayerTest {
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Setup tests
|
---|
21 | */
|
---|
22 | @BeforeClass
|
---|
23 | public static void setUpBeforeClass() {
|
---|
24 | JOSMFixture.createUnitTestFixture().init(true);
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Unit test of {@link ValidatorLayer#ValidatorLayer}.
|
---|
29 | */
|
---|
30 | @Test
|
---|
31 | public void testValidatorLayer() {
|
---|
32 | ValidatorLayer layer = null;
|
---|
33 | try {
|
---|
34 | layer = new ValidatorLayer();
|
---|
35 | Main.getLayerManager().addLayer(layer);
|
---|
36 | assertFalse(layer.isMergable(null));
|
---|
37 | assertNotNull(layer.getIcon());
|
---|
38 | assertEquals("<html>No validation errors</html>", layer.getToolTipText());
|
---|
39 | assertEquals("<html>No validation errors</html>", layer.getInfoComponent());
|
---|
40 | assertTrue(layer.getMenuEntries().length > 0);
|
---|
41 | } finally {
|
---|
42 | // Ensure we clean the place before leaving, even if test fails.
|
---|
43 | if (layer != null) {
|
---|
44 | Main.getLayerManager().removeLayer(layer);
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|