Changeset 14369 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2018-10-27T13:03:51+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16899 - HelpBrowserTest: fix for non-headless mode (patch by ris)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HelpBrowserTest.java

    r14138 r14369  
    55import static org.junit.Assert.assertNull;
    66
     7import javax.swing.JOptionPane;
     8
    79import org.junit.Rule;
    810import org.junit.Test;
     11import org.openstreetmap.josm.TestUtils;
    912import org.openstreetmap.josm.testutils.JOSMTestRules;
     13import org.openstreetmap.josm.testutils.mockers.JOptionPaneSimpleMocker;
    1014import org.openstreetmap.josm.tools.LanguageInfo.LocaleType;
     15
     16import com.google.common.collect.ImmutableMap;
    1117
    1218import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    8995    @Test
    9096    public void testEditAction() {
     97        TestUtils.assumeWorkingJMockit();
    9198        IHelpBrowser browser = newHelpBrowser();
    9299        assertNull(browser.getUrl());
     
    97104        new HelpBrowser.EditAction(browser).actionPerformed(null);
    98105
     106        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
     107            ImmutableMap.<String, Object>of(
     108                "<html>The current URL <tt>https://josm.openstreetmap.de/javadoc</tt><br>is an external "
     109                + "URL. Editing is only possible for help topics<br>on the help server "
     110                + "<tt>https://josm.openstreetmap.de</tt>.</html>",
     111                JOptionPane.OK_OPTION
     112            )
     113        );
     114
    99115        browser.openUrl(URL_3);
    100116        assertEquals(URL_3, browser.getUrl());
    101117        new HelpBrowser.EditAction(browser).actionPerformed(null);
     118
     119        assertEquals(1, jopsMocker.getInvocationLog().size());
     120        Object[] invocationLogEntry = jopsMocker.getInvocationLog().get(0);
     121        assertEquals(JOptionPane.OK_OPTION, (int) invocationLogEntry[0]);
     122        assertEquals("Warning", invocationLogEntry[2]);
    102123    }
    103124
Note: See TracChangeset for help on using the changeset viewer.