Skip to content

Commit 6434421

Browse files
lijunyzzZsnicoll
authored andcommitted
Delete redundant variables
See spring-projectsgh-17864
1 parent ba4c5be commit 6434421

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ private BindValidationException bindAndExpectValidationError(Runnable action) {
198198
action.run();
199199
}
200200
catch (BindException ex) {
201-
BindValidationException cause = (BindValidationException) ex.getCause();
202-
return cause;
201+
return (BindValidationException) ex.getCause();
203202
}
204203
throw new IllegalStateException("Did not throw");
205204
}

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jackson/JsonObjectDeserializerTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,8 @@ void getRequiredNodeWhenNodeIsNullNodeShouldThrowException() {
176176
@Test
177177
void getRequiredNodeWhenNodeIsFoundShouldReturnNode() {
178178
JsonNode node = mock(JsonNode.class);
179-
JsonNode tree = node;
180-
given(tree.get("test")).willReturn(node);
181-
assertThat(this.testDeserializer.testGetRequiredNode(tree, "test")).isEqualTo(node);
179+
given(node.get("test")).willReturn(node);
180+
assertThat(this.testDeserializer.testGetRequiredNode(node, "test")).isEqualTo(node);
182181
}
183182

184183
static class TestJsonObjectDeserializer<T> extends JsonObjectDeserializer<T> {

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ ServletRegistrationBean<DispatcherServlet> dispatcherRegistration(DispatcherServ
187187

188188
@Bean
189189
DispatcherServlet dispatcherServlet() {
190-
DispatcherServlet dispatcherServlet = new DispatcherServlet();
191190
// Can configure dispatcher servlet here as would usually do via init-params
192-
return dispatcherServlet;
191+
return new DispatcherServlet();
193192
}
194193

195194
@Bean

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,7 @@ protected ClientHttpResponse getClientResponse(String url, HttpMethod method,
10841084
String[] parts = header.split(":");
10851085
request.getHeaders().add(parts[0], parts[1]);
10861086
}
1087-
ClientHttpResponse response = request.execute();
1088-
return response;
1087+
return request.execute();
10891088
}
10901089

10911090
protected void assertForwardHeaderIsUsed(ServletWebServerFactory factory) throws IOException, URISyntaxException {

0 commit comments

Comments
 (0)