From d8de6fff534529da9d5d557e457f37058ce9f122 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Thu, 10 Oct 2019 21:09:05 +0200 Subject: [PATCH] Polish See gh-18557 --- .../IntegrationGraphEndpointTests.java | 24 ++++++------------- src/checkstyle/checkstyle.xml | 2 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpointTests.java index fd0abc76f3c..fc9468b71ff 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/integration/IntegrationGraphEndpointTests.java @@ -16,10 +16,7 @@ package org.springframework.boot.actuate.integration; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; import org.springframework.integration.graph.Graph; import org.springframework.integration.graph.IntegrationGraphServer; @@ -36,30 +33,23 @@ import static org.mockito.Mockito.verify; */ class IntegrationGraphEndpointTests { - @Mock - private IntegrationGraphServer integrationGraphServer; + private final IntegrationGraphServer server = mock(IntegrationGraphServer.class); - private IntegrationGraphEndpoint integrationGraphEndpoint; - - @BeforeEach - void setUp() { - MockitoAnnotations.initMocks(this); - this.integrationGraphEndpoint = new IntegrationGraphEndpoint(this.integrationGraphServer); - } + private final IntegrationGraphEndpoint endpoint = new IntegrationGraphEndpoint(this.server); @Test void readOperationShouldReturnGraph() { Graph mockedGraph = mock(Graph.class); - given(this.integrationGraphServer.getGraph()).willReturn(mockedGraph); - Graph graph = this.integrationGraphEndpoint.graph(); - verify(this.integrationGraphServer).getGraph(); + given(this.server.getGraph()).willReturn(mockedGraph); + Graph graph = this.endpoint.graph(); + verify(this.server).getGraph(); assertThat(graph).isEqualTo(mockedGraph); } @Test void writeOperationShouldRebuildGraph() { - this.integrationGraphEndpoint.rebuild(); - verify(this.integrationGraphServer).rebuild(); + this.endpoint.rebuild(); + verify(this.server).rebuild(); } } diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 65fad54150a..809f7de36c9 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -15,7 +15,7 @@ + value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^reactor\.core\.support\.Assert" />