source: josm/trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java

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

See #16567: Update to JUnit 5

This removes new JOSMTestRules() with no additional setup and most
JOSMFixture calls.

Removing the bare JOSMTestRules speeds up the test suite since there are two
fewer System.gc() calls per test.

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer.gpx;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5
6import javax.swing.JLabel;
7import javax.swing.JPanel;
8
9import org.junit.jupiter.api.Disabled;
10import org.junit.jupiter.api.Test;
11import org.openstreetmap.josm.TestUtils;
12import org.openstreetmap.josm.gui.ExtendedDialog;
13import org.openstreetmap.josm.gui.layer.GpxLayerTest;
14import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
15
16/**
17 * Unit tests of {@link ChooseTrackVisibilityAction} class.
18 */
19class ChooseTrackVisibilityActionTest {
20 /**
21 * Test action.
22 * @throws Exception if an error occurs
23 */
24 @Test
25 @Disabled("broken, see #16796")
26 void testAction() throws Exception {
27 TestUtils.assumeWorkingJMockit();
28 final ExtendedDialogMocker edMocker = new ExtendedDialogMocker() {
29 @Override
30 protected String getString(final ExtendedDialog instance) {
31 return ((JLabel) ((JPanel) instance.getContentPane().getComponent(0)).getComponent(2)).getText();
32 }
33 };
34 edMocker.getMockResultMap().put(
35 "<html>Select all tracks that you want to be displayed. " +
36 "You can drag select a range of tracks or use CTRL+Click to select specific ones. " +
37 "The map is updated live in the background. "+
38 "Open the URLs by double clicking them, edit name and description by double clicking the cell.</html>",
39 "Show all"
40 );
41
42 new ChooseTrackVisibilityAction(GpxLayerTest.getMinimalGpxLayer()).actionPerformed(null);
43
44 assertEquals(1, edMocker.getInvocationLog().size());
45 Object[] invocationLogEntry = edMocker.getInvocationLog().get(0);
46 assertEquals(2, (int) invocationLogEntry[0]);
47 assertEquals("Set track visibility for Bananas", invocationLogEntry[2]);
48 }
49}
Note: See TracBrowser for help on using the repository browser.