source: josm/trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java@ 10050

Last change on this file since 10050 was 9870, checked in by Don-vip, 8 years ago

PluginHandler: deprecate kendzi3d-jogl plugin, remove unused code, fix findbugs warning, add unit tests

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.plugins;
3
4import static org.junit.Assert.assertNotNull;
5import static org.junit.Assert.assertTrue;
6
7import java.util.Arrays;
8import java.util.List;
9
10import org.junit.BeforeClass;
11import org.junit.Test;
12import org.openstreetmap.josm.JOSMFixture;
13import org.openstreetmap.josm.plugins.PluginHandler.DeprecatedPlugin;
14import org.openstreetmap.josm.tools.Utils;
15
16import nl.jqno.equalsverifier.EqualsVerifier;
17
18/**
19 * Unit tests of {@link PluginHandler} class.
20 */
21public class PluginHandlerTest {
22
23 /**
24 * Setup test.
25 */
26 @BeforeClass
27 public static void setUp() {
28 JOSMFixture.createUnitTestFixture().init();
29 }
30
31 /**
32 * Unit test of methods {@link DeprecatedPlugin#equals} and {@link DeprecatedPlugin#hashCode}.
33 */
34 @Test
35 public void equalsContract() {
36 EqualsVerifier.forClass(DeprecatedPlugin.class).usingGetClass().verify();
37 }
38
39 /**
40 * Unit test of {@link PluginHandler#buildListOfPluginsToLoad}.
41 */
42 @Test
43 public void testBuildListOfPluginsToLoad() {
44 final String old = System.getProperty("josm.plugins");
45 try {
46 System.setProperty("josm.plugins",
47 Utils.join(",", PluginHandler.DEPRECATED_PLUGINS) + "," +
48 Utils.join(",", Arrays.asList(PluginHandler.UNMAINTAINED_PLUGINS)));
49 List<PluginInformation> list = PluginHandler.buildListOfPluginsToLoad(null, null);
50 assertNotNull(list);
51 assertTrue(list.isEmpty());
52 } finally {
53 if (old != null) {
54 System.setProperty("josm.plugins", old);
55 } else {
56 System.clearProperty("josm.plugins");
57 }
58 }
59 }
60}
Note: See TracBrowser for help on using the repository browser.