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


Ignore:
Timestamp:
2023-08-09T15:30:01+02:00 (15 months ago)
Author:
taylor.smock
Message:

Fix #22832: Code cleanup and some simplification, documentation fixes (patch by gaben)

There should not be any functional changes in this patch; it is intended to do
the following:

  • Simplify and cleanup code (example: Arrays.asList(item) -> Collections.singletonList(item))
  • Fix typos in documentation (which also corrects the documentation to match what actually happens, in some cases)
Location:
trunk/test/unit/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/protobuf/ProtobufPackedTest.java

    r18695 r18801  
    33
    44import static org.junit.jupiter.api.Assertions.assertArrayEquals;
    5 
    6 import java.io.ByteArrayOutputStream;
    75
    86import org.junit.jupiter.api.Test;
     
    1412    @Test
    1513    void testSingleByteNumbers() {
    16         long[] numbers = new ProtobufPacked(new ByteArrayOutputStream(), ProtobufTest.toByteArray(new int[]{0, 0, 1, 1, 2, 2, 3, 3, 4, 4}))
     14        long[] numbers = new ProtobufPacked(ProtobufTest.toByteArray(new int[]{0, 0, 1, 1, 2, 2, 3, 3, 4, 4}))
    1715                .getArray();
    1816        assertArrayEquals(new long[] {0, 0, 1, 1, 2, 2, 3, 3, 4, 4}, numbers);
     
    2220    void testMultipleByteNumbers() {
    2321        byte[] bytes = ProtobufTest.toByteArray(new int[] {-128, 64, -18, 49, -70, 3});
    24         long[] numbers = new ProtobufPacked(new ByteArrayOutputStream(), bytes).getArray();
     22        long[] numbers = new ProtobufPacked(bytes).getArray();
    2523        assertArrayEquals(new long[] {8192, 6382, 442}, numbers);
    2624    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java

    r18690 r18801  
    1010
    1111/**
    12  * JUnit Test of Multipolygon validation test.
     12 * JUnit Test of {@link DirectionNodes} validation test.
    1313 */
    1414class DirectionNodesTest {
    15 
    1615
    1716    /**
     
    2726     */
    2827    @Test
    29     void testDirectionsNodesTestFile() throws Exception {
     28    void testDirectionNodesTestFile() throws Exception {
    3029        final DirectionNodes test = new DirectionNodes();
    3130        ValidatorTestUtils.testSampleFile("nodist/data/direction-nodes.osm", DataSet::getNodes, null, test);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java

    r18690 r18801  
    2323
    2424/**
    25  * JUnit Test of Multipolygon validation test.
     25 * JUnit Test of {@link SelfIntersectingWay} validation test.
    2626 */
    2727class SelfIntersectingWayTest {
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r18037 r18801  
    77
    88import java.io.ByteArrayInputStream;
    9 import java.io.File;
    109import java.io.FileInputStream;
    1110import java.io.IOException;
     
    3938    public static GpxData parseGpxData(String filename) throws IOException, SAXException {
    4039        final GpxData result;
    41         try (FileInputStream in = new FileInputStream(new File(filename))) {
     40        try (FileInputStream in = new FileInputStream(filename)) {
    4241            GpxReader reader = new GpxReader(in);
    4342            assertTrue(reader.parse(false));
  • trunk/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java

    r17090 r18801  
    1717        final Throwable cause = t.getCause();
    1818        if (cause instanceof AssertionError) {
    19             throw (AssertionError) cause;
     19            throw cause;
    2020        }
    2121
Note: See TracChangeset for help on using the changeset viewer.