Changeset 17698 in josm for trunk


Ignore:
Timestamp:
2021-03-30T21:49:33+02:00 (4 years ago)
Author:
simon04
Message:

Simplify RemoteControlTest.testListOfCommands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java

    r17697 r17698  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import java.io.BufferedReader;
    76import java.io.IOException;
    87import java.io.InputStream;
    9 import java.io.InputStreamReader;
    108import java.net.HttpURLConnection;
    119import java.net.URL;
    1210import java.nio.charset.StandardCharsets;
    1311import java.security.GeneralSecurityException;
    14 import java.util.stream.Collectors;
    1512
    1613import org.junit.jupiter.api.AfterEach;
     
    2017import org.openstreetmap.josm.spi.preferences.Config;
    2118import org.openstreetmap.josm.testutils.JOSMTestRules;
     19import org.openstreetmap.josm.tools.Utils;
    2220
    2321import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    6967        assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST);
    7068        try (InputStream is = connection.getErrorStream()) {
    71             // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes
    72             String responseBody;
    73             try (BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
    74                 responseBody = in.lines().collect(Collectors.joining("\n"));
    75             }
     69            String responseBody = new String(Utils.readBytesFromStream(is), StandardCharsets.UTF_8);
    7670            assert responseBody.contains(RequestProcessor.getUsageAsHtml());
    7771        }
Note: See TracChangeset for help on using the changeset viewer.