source: josm/trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java@ 14119

Last change on this file since 14119 was 14119, checked in by Don-vip, 6 years ago

see #15229 - deprecate all Main methods returning an URL

  • 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.gui.tagging.presets.items;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertFalse;
6import static org.junit.Assert.assertTrue;
7
8import java.util.Collections;
9
10import javax.swing.JPanel;
11
12import org.junit.BeforeClass;
13import org.junit.Test;
14import org.openstreetmap.josm.JOSMFixture;
15import org.openstreetmap.josm.data.osm.OsmPrimitive;
16import org.openstreetmap.josm.spi.preferences.Config;
17
18/**
19 * Unit tests of {@link Link} class.
20 */
21public class LinkTest {
22
23 /**
24 * Setup test.
25 */
26 @BeforeClass
27 public static void setUp() {
28 JOSMFixture.createUnitTestFixture().init();
29 }
30
31 /**
32 * Unit test for {@link Link#addToPanel}.
33 */
34 @Test
35 public void testAddToPanel() {
36 Link l = new Link();
37 JPanel p = new JPanel();
38 assertEquals(0, p.getComponentCount());
39 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
40 assertEquals(0, p.getComponentCount());
41
42 l.href = Config.getUrls().getJOSMWebsite();
43 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
44 assertTrue(p.getComponentCount() > 0);
45
46 l.locale_href = Config.getUrls().getJOSMWebsite();
47 assertFalse(l.addToPanel(p, Collections.<OsmPrimitive>emptyList(), false));
48 assertTrue(p.getComponentCount() > 0);
49 }
50}
Note: See TracBrowser for help on using the repository browser.