Changeset 16436 in josm for trunk/test/unit
- Timestamp:
- 2020-05-17T12:08:17+02:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r13813 r16436 13 13 import java.util.HashMap; 14 14 import java.util.Map; 15 import java.util.stream.Collectors; 16 import java.util.stream.IntStream; 15 17 16 18 import org.junit.Assert; … … 65 67 // Add a map with too long values => IllegalArgumentException 66 68 keys = new HashMap<>(); 67 StringBuilder b = new StringBuilder(MAX_CHANGESET_TAG_LENGTH + 1); 68 for (int i = 0; i < MAX_CHANGESET_TAG_LENGTH + 1; i++) { 69 b.append("x"); 70 } 71 keys.put("test", b.toString()); 69 // Java 11: use String.repeat 70 keys.put("test", IntStream.range(0, MAX_CHANGESET_TAG_LENGTH + 1).mapToObj(i -> "x").collect(Collectors.joining())); 72 71 try { 73 72 cs.setKeys(keys); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r16099 r16436 13 13 import java.util.ArrayList; 14 14 import java.util.HashMap; 15 import java.util.HashSet;16 15 import java.util.List; 17 16 import java.util.Map; … … 19 18 import java.util.Set; 20 19 import java.util.TreeSet; 20 import java.util.stream.Collectors; 21 21 22 22 import org.junit.BeforeClass; … … 160 160 public void testNonRegression() throws IOException { 161 161 List<TestData> allData = readData(); 162 Set<String> dataCodes = new HashSet<>(); 163 for (TestData data : allData) { 164 dataCodes.add(data.code); 165 } 162 Set<String> dataCodes = allData.stream().map(data -> data.code).collect(Collectors.toSet()); 166 163 167 164 StringBuilder fail = new StringBuilder(); -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java
r16311 r16436 15 15 import java.util.List; 16 16 import java.util.Optional; 17 import java.util.stream.IntStream; 17 18 18 19 import org.junit.Rule; … … 160 161 return false; 161 162 } 162 for (int i = 0; i < ((Way) p1).getNodes().size(); i++) { 163 if (!areEqualNodes(((Way) p1).getNode(i), ((Way) p2).getNode(i))) { 164 return false; 165 } 166 } 167 return true; 163 return IntStream.range(0, ((Way) p1).getNodes().size()) 164 .allMatch(i -> areEqualNodes(((Way) p1).getNode(i), ((Way) p2).getNode(i))); 168 165 } 169 166 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r15469 r16436 13 13 import java.security.GeneralSecurityException; 14 14 import java.security.KeyStore.TrustedCertificateEntry; 15 import java.util.stream.Collectors; 15 16 16 17 import org.junit.After; … … 88 89 try (InputStream is = connection.getErrorStream()) { 89 90 // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes 90 String Builder responseBody = new StringBuilder();91 String responseBody; 91 92 try (BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { 92 String s; 93 while ((s = in.readLine()) != null) { 94 responseBody.append(s); 95 responseBody.append("\n"); 96 } 93 responseBody = in.lines().collect(Collectors.joining("\n")); 97 94 } 98 assert responseBody. toString().contains(RequestProcessor.getUsageAsHtml());95 assert responseBody.contains(RequestProcessor.getUsageAsHtml()); 99 96 } 100 97 }
Note:
See TracChangeset
for help on using the changeset viewer.