- Timestamp:
- 2021-03-30T21:49:33+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r17697 r17698 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import java.io.BufferedReader;7 6 import java.io.IOException; 8 7 import java.io.InputStream; 9 import java.io.InputStreamReader;10 8 import java.net.HttpURLConnection; 11 9 import java.net.URL; 12 10 import java.nio.charset.StandardCharsets; 13 11 import java.security.GeneralSecurityException; 14 import java.util.stream.Collectors;15 12 16 13 import org.junit.jupiter.api.AfterEach; … … 20 17 import org.openstreetmap.josm.spi.preferences.Config; 21 18 import org.openstreetmap.josm.testutils.JOSMTestRules; 19 import org.openstreetmap.josm.tools.Utils; 22 20 23 21 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 69 67 assertEquals(connection.getResponseCode(), HttpURLConnection.HTTP_BAD_REQUEST); 70 68 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); 76 70 assert responseBody.contains(RequestProcessor.getUsageAsHtml()); 77 71 }
Note:
See TracChangeset
for help on using the changeset viewer.