Changeset 18818 in josm


Ignore:
Timestamp:
2023-08-23T00:10:21+02:00 (10 months ago)
Author:
taylor.smock
Message:

Fix tests

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r18727 r18818  
    188188                <!-- Indicate that this jar may have version specific classes. Only used in Java9+. -->
    189189                <attribute name="Multi-Release" value="true"/>
     190                <attribute name="Automatic-Module-Name" value="org.openstreetmap.josm"/>
    190191            </manifest>
    191192        </jar>
  • trunk/src/org/openstreetmap/josm/io/GpxParser.java

    r18817 r18818  
    1818
    1919import java.time.DateTimeException;
    20 import java.util.ArrayDeque;
    2120import java.util.ArrayList;
    2221import java.util.Collection;
    23 import java.util.Deque;
    2422import java.util.HashMap;
    2523import java.util.LinkedList;
     
    2725import java.util.Map;
    2826import java.util.Optional;
     27import java.util.Stack;
    2928
    3029import org.openstreetmap.josm.data.Bounds;
     
    7776    private GpxExtensionCollection currentExtensionCollection;
    7877    private GpxExtensionCollection currentTrackExtensionCollection;
    79     private Deque<State> states;
    80     private final Deque<String[]> elements = new ArrayDeque<>();
     78    private final Stack<State> states = new Stack<>();
     79    private final Stack<String[]> elements = new Stack<>();
    8180
    8281    private StringBuilder accumulator = new StringBuilder();
     
    8786    public void startDocument() {
    8887        accumulator = new StringBuilder();
    89         states = new ArrayDeque<>();
    9088        data = new GpxData(true);
    9189        currentExtensionCollection = new GpxExtensionCollection();
     
    402400     */
    403401    private void startElementExt(String namespaceURI, String qName, Attributes attributes) {
    404         if (states.peekLast() == State.TRK) {
     402        if (states.lastElement() == State.TRK) {
    405403            currentTrackExtensionCollection.openChild(namespaceURI, qName, attributes);
    406404        } else {
     
    651649                convertUrlToLink(currentWayPoint.attr);
    652650                currentWayPoint.getExtensions().addAll(currentExtensionCollection);
    653                 if (!currentWayPoint.isLatLonKnown()) {
    654                     currentExtensionCollection.clear();
    655                     throw new SAXException(tr("{0} element does not have valid latitude and/or longitude.", "wpt"));
    656                 }
    657651                data.waypoints.add(currentWayPoint);
    658652                currentExtensionCollection.clear();
     
    723717        } else if (currentExtensionCollection != null) {
    724718            String acc = accumulator.toString().trim();
    725             if (states.peekLast() == State.TRK) {
     719            if (states.lastElement() == State.TRK) {
    726720                currentTrackExtensionCollection.closeChild(qName, acc); //a segment inside the track can have an extension too
    727721            } else {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java

    r17275 r18818  
    1212import java.util.stream.Collectors;
    1313
    14 import org.junit.jupiter.api.extension.RegisterExtension;
    1514import org.junit.jupiter.api.Test;
    1615import org.openstreetmap.josm.TestUtils;
     
    1918import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.ColorMode;
    2019import org.openstreetmap.josm.io.GpxReaderTest;
    21 import org.openstreetmap.josm.testutils.JOSMTestRules;
     20import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    2221import org.openstreetmap.josm.tools.ColorHelper;
    2322import org.xml.sax.SAXException;
    24 
    25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2623
    2724/**
    2825 * Unit tests of {@link GpxDrawHelper} class.
    2926 */
     27@BasicPreferences
    3028class GpxDrawHelperTest {
    31 
    32     /**
    33      * Setup test.
    34      */
    35     @RegisterExtension
    36     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    37     public JOSMTestRules test = new JOSMTestRules();
    3829
    3930    /**
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r18817 r18818  
    104104
    105105    @ParameterizedTest
    106     @ValueSource(strings = {
    107             "<gpx><wpt></wpt></gpx>",
    108     })
     106    @ValueSource(strings = "<gpx><wpt></wpt></gpx>")
    109107    void testIncompleteLocations(String gpx) {
    110108        SAXException saxException = assertThrows(SAXException.class,
Note: See TracChangeset for help on using the changeset viewer.