Changeset 11110 in josm for trunk


Ignore:
Timestamp:
2016-10-09T13:47:44+02:00 (3 years ago)
Author:
Don-vip
Message:

add more unit tests

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java

    r10627 r11110  
    55
    66import java.awt.Component;
     7import java.awt.GraphicsEnvironment;
    78import java.io.IOException;
     9import java.util.Collections;
    810import java.util.List;
    911
     
    5961    protected void finish() {
    6062        if (JosmUserIdentityManager.getInstance().isAnonymous()) {
    61             JOptionPane.showMessageDialog(
    62                     GuiHelper.getFrameForComponent(parent),
    63                     "<html>" + tr("Could not retrieve the list of your open changesets because<br>"
    64                             + "JOSM does not know your identity.<br>"
    65                             + "You have either chosen to work anonymously or you are not entitled<br>"
    66                             + "to know the identity of the user on whose behalf you are working.")
    67                             + "</html>",
    68                             tr("Missing user identity"),
    69                             JOptionPane.ERROR_MESSAGE
    70             );
     63            String msg = tr("Could not retrieve the list of your open changesets because<br>"
     64                    + "JOSM does not know your identity.<br>"
     65                    + "You have either chosen to work anonymously or you are not entitled<br>"
     66                    + "to know the identity of the user on whose behalf you are working.");
     67            Main.warn(msg);
     68            if (!GraphicsEnvironment.isHeadless()) {
     69                JOptionPane.showMessageDialog(GuiHelper.getFrameForComponent(parent),
     70                        "<html>" + msg + "</html>", tr("Missing user identity"), JOptionPane.ERROR_MESSAGE);
     71            }
    7172            return;
    7273        }
     
    153154    }
    154155
     156    /**
     157     * Determines if this task has been cancelled.
     158     * @return {@code true} if this task has been cancelled
     159     */
    155160    public boolean isCanceled() {
    156161        return canceled;
    157162    }
     163
     164    /**
     165     * Returns the changesets.
     166     * @return the changesets, or {@code null}
     167     * @since 11110
     168     */
     169    public final List<Changeset> getChangesets() {
     170        return changesets != null ? Collections.unmodifiableList(changesets) : null;
     171    }
    158172}
  • trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java

    r10242 r11110  
    5858     * @return the list of changesets read from the server
    5959     * @throws IllegalArgumentException if query is null
    60      * @throws OsmTransferException if something goes wrong w
     60     * @throws OsmTransferException if something goes wrong
    6161     */
    6262    public List<Changeset> queryChangesets(ChangesetQuery query, ProgressMonitor monitor) throws OsmTransferException {
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java

    r11109 r11110  
    1212import org.openstreetmap.josm.Main;
    1313import org.openstreetmap.josm.data.coor.LatLon;
     14import org.openstreetmap.josm.data.osm.DataSet;
    1415import org.openstreetmap.josm.data.osm.Node;
    1516import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    6970    public void testSelectTargetNode() {
    7071        assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList()));
    71         assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(new Node(1))).getId());
     72        DataSet ds = new DataSet();
     73        Node n1 = new Node(1);
     74        ds.addPrimitive(n1);
     75        assertEquals(1, MergeNodesAction.selectTargetNode(Arrays.asList(n1)).getId());
    7276    }
    7377}
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r11102 r11110  
    5858
    5959            CommandStackDialog dlg = new CommandStackDialog();
    60             dlg.showDialog();
     60            Main.map.addToggleDialog(dlg);
     61            dlg.unfurlDialog();
    6162            assertTrue(dlg.isVisible());
     63            Main.map.removeToggleDialog(dlg);
    6264            dlg.hideDialog();
    6365            assertFalse(dlg.isVisible());
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r10899 r11110  
    269269
    270270        // TODO: Remove global listeners and other global state.
    271         Main.pref.resetToInitialState();;
     271        Main.pref.resetToInitialState();
    272272        Main.platform = null;
    273273        // Parts of JOSM uses weak references - destroy them.
Note: See TracChangeset for help on using the changeset viewer.