Use Map#forEach instead of Map#entrySet#forEach

See gh-1449
This commit is contained in:
diguage
2017-06-05 16:39:28 +08:00
committed by Stephane Nicoll
parent 424bc75fb1
commit 2efa06237a
10 changed files with 38 additions and 39 deletions

View File

@@ -281,8 +281,8 @@ public class BaseViewTests {
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private void checkContainsAll(Map expected, Map<String, Object> actual) {
expected.keySet().stream().forEach(
key -> assertEquals("Values for model key '" + key + "' must match", expected.get(key), actual.get(key))
expected.forEach(
(k, v) -> assertEquals("Values for model key '" + k + "' must match", expected.get(k), actual.get(k))
);
}

View File

@@ -84,8 +84,9 @@ public class InternalResourceViewTests {
view.render(model, request, response);
assertEquals(url, response.getForwardedUrl());
model.keySet().stream().forEach(
key -> assertEquals("Values for model key '" + key + "' must match", model.get(key), request.getAttribute(key))
model.forEach(
(key, value) -> assertEquals("Values for model key '" + key + "' must match", value, request.getAttribute(key))
);
}
@@ -101,7 +102,7 @@ public class InternalResourceViewTests {
view.render(model, request, response);
assertEquals(url, response.getIncludedUrl());
model.keySet().stream().forEach(key -> verify(request).setAttribute(key, model.get(key)));
model.forEach((key, value) -> verify(request).setAttribute(key, value));
}
@Test
@@ -116,7 +117,7 @@ public class InternalResourceViewTests {
view.render(model, request, response);
assertEquals(url, response.getIncludedUrl());
model.keySet().stream().forEach(key -> verify(request).setAttribute(key, model.get(key)));
model.forEach((key, value) -> verify(request).setAttribute(key, value));
}
@Test
@@ -132,7 +133,7 @@ public class InternalResourceViewTests {
view.render(model, request, response);
assertEquals(url, response.getIncludedUrl());
model.keySet().stream().forEach(key -> verify(request).setAttribute(key, model.get(key)));
model.forEach((k, v) -> verify(request).setAttribute(k, v));
}
}