Remove public modifier on JUnit5 lifecycle methods

See gh-17292
This commit is contained in:
Stephane Nicoll 2019-06-21 18:09:05 +02:00
parent c7d3b7a9f1
commit e560b7f6ba
310 changed files with 361 additions and 362 deletions

View File

@ -46,7 +46,7 @@ class SpringApplicationHierarchyTests {
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
@AfterEach @AfterEach
public void after() { void after() {
ApplicationContextTestUtils.closeAll(this.context); ApplicationContextTestUtils.closeAll(this.context);
} }

View File

@ -92,7 +92,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
ProjectInfoAutoConfiguration.class, ReactiveCloudFoundryActuatorAutoConfiguration.class)); ProjectInfoAutoConfiguration.class, ReactiveCloudFoundryActuatorAutoConfiguration.class));
@AfterEach @AfterEach
public void close() { void close() {
HttpResources.reset(); HttpResources.reset();
} }

View File

@ -52,7 +52,7 @@ class ReactiveCloudFoundrySecurityInterceptorTests {
private CloudFoundrySecurityInterceptor interceptor; private CloudFoundrySecurityInterceptor interceptor;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, "my-app-id"); this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, "my-app-id");
} }

View File

@ -54,14 +54,14 @@ class ReactiveCloudFoundrySecurityServiceTests {
private WebClient.Builder builder; private WebClient.Builder builder;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.server = new MockWebServer(); this.server = new MockWebServer();
this.builder = WebClient.builder().baseUrl(this.server.url("/").toString()); this.builder = WebClient.builder().baseUrl(this.server.url("/").toString());
this.securityService = new ReactiveCloudFoundrySecurityService(this.builder, CLOUD_CONTROLLER, false); this.securityService = new ReactiveCloudFoundrySecurityService(this.builder, CLOUD_CONTROLLER, false);
} }
@AfterEach @AfterEach
public void shutdown() throws Exception { void shutdown() throws Exception {
this.server.shutdown(); this.server.shutdown();
} }

View File

@ -84,7 +84,7 @@ class ReactiveTokenValidatorTests {
private static final Map<String, String> VALID_KEYS = new ConcurrentHashMap<>(); private static final Map<String, String> VALID_KEYS = new ConcurrentHashMap<>();
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
VALID_KEYS.put("valid-key", VALID_KEY); VALID_KEYS.put("valid-key", VALID_KEY);
INVALID_KEYS.put("invalid-key", INVALID_KEY); INVALID_KEYS.put("invalid-key", INVALID_KEY);

View File

@ -54,7 +54,7 @@ class CloudFoundrySecurityInterceptorTests {
private MockHttpServletRequest request; private MockHttpServletRequest request;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, "my-app-id"); this.interceptor = new CloudFoundrySecurityInterceptor(this.tokenValidator, this.securityService, "my-app-id");
this.request = new MockHttpServletRequest(); this.request = new MockHttpServletRequest();

View File

@ -60,7 +60,7 @@ class CloudFoundrySecurityServiceTests {
private MockRestServiceServer server; private MockRestServiceServer server;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockServerRestTemplateCustomizer mockServerCustomizer = new MockServerRestTemplateCustomizer(); MockServerRestTemplateCustomizer mockServerCustomizer = new MockServerRestTemplateCustomizer();
RestTemplateBuilder builder = new RestTemplateBuilder(mockServerCustomizer); RestTemplateBuilder builder = new RestTemplateBuilder(mockServerCustomizer);
this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false); this.securityService = new CloudFoundrySecurityService(builder, CLOUD_CONTROLLER, false);

View File

@ -42,7 +42,7 @@ class SkipSslVerificationHttpRequestFactoryTests {
private WebServer webServer; private WebServer webServer;
@AfterEach @AfterEach
public void shutdownContainer() { void shutdownContainer() {
if (this.webServer != null) { if (this.webServer != null) {
this.webServer.stop(); this.webServer.stop();
} }

View File

@ -84,7 +84,7 @@ class TokenValidatorTests {
private static final Map<String, String> VALID_KEYS = Collections.singletonMap("valid-key", VALID_KEY); private static final Map<String, String> VALID_KEYS = Collections.singletonMap("valid-key", VALID_KEY);
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.tokenValidator = new TokenValidator(this.securityService); this.tokenValidator = new TokenValidator(this.securityService);
} }

View File

@ -41,7 +41,7 @@ class ExposeExcludePropertyEndpointFilterTests {
private ExposeExcludePropertyEndpointFilter<?> filter; private ExposeExcludePropertyEndpointFilter<?> filter;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
} }

View File

@ -58,7 +58,7 @@ class ConditionsReportEndpointDocumentationTests extends MockMvcEndpointDocument
@Override @Override
@BeforeEach @BeforeEach
public void setup(RestDocumentationContextProvider restDocumentation) { void setup(RestDocumentationContextProvider restDocumentation) {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext) this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext)
.apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris()).build(); .apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris()).build();
} }

View File

@ -70,7 +70,7 @@ class MappingsEndpointReactiveDocumentationTests extends AbstractEndpointDocumen
private WebTestClient client; private WebTestClient client;
@BeforeEach @BeforeEach
public void webTestClient(RestDocumentationContextProvider restDocumentation) { void webTestClient(RestDocumentationContextProvider restDocumentation) {
this.client = WebTestClient.bindToServer() this.client = WebTestClient.bindToServer()
.filter(documentationConfiguration(restDocumentation).snippets().withDefaults()) .filter(documentationConfiguration(restDocumentation).snippets().withDefaults())
.baseUrl("http://localhost:" + this.port).build(); .baseUrl("http://localhost:" + this.port).build();

View File

@ -70,7 +70,7 @@ class MappingsEndpointServletDocumentationTests extends AbstractEndpointDocument
private WebTestClient client; private WebTestClient client;
@BeforeEach @BeforeEach
public void webTestClient(RestDocumentationContextProvider restDocumentation) { void webTestClient(RestDocumentationContextProvider restDocumentation) {
this.client = WebTestClient.bindToServer().filter(documentationConfiguration(restDocumentation)) this.client = WebTestClient.bindToServer().filter(documentationConfiguration(restDocumentation))
.baseUrl("http://localhost:" + this.port).build(); .baseUrl("http://localhost:" + this.port).build();
} }

View File

@ -44,7 +44,7 @@ public abstract class MockMvcEndpointDocumentationTests extends AbstractEndpoint
private WebApplicationContext applicationContext; private WebApplicationContext applicationContext;
@BeforeEach @BeforeEach
public void setup(RestDocumentationContextProvider restDocumentation) { void setup(RestDocumentationContextProvider restDocumentation) {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext) this.mockMvc = MockMvcBuilders.webAppContextSetup(this.applicationContext)
.apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris()).build(); .apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).uris()).build();
} }

View File

@ -45,7 +45,7 @@ class InfoContributorAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class ControllerEndpointWebFluxIntegrationTests {
private AnnotationConfigReactiveWebApplicationContext context; private AnnotationConfigReactiveWebApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
TestSecurityContextHolder.clearContext(); TestSecurityContextHolder.clearContext();
this.context.close(); this.context.close();
} }

View File

@ -63,7 +63,7 @@ class ControllerEndpointWebMvcIntegrationTests {
private AnnotationConfigServletWebApplicationContext context; private AnnotationConfigServletWebApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
TestSecurityContextHolder.clearContext(); TestSecurityContextHolder.clearContext();
this.context.close(); this.context.close();
} }

View File

@ -73,7 +73,7 @@ class WebMvcEndpointIntegrationTests {
private AnnotationConfigServletWebApplicationContext context; private AnnotationConfigServletWebApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
TestSecurityContextHolder.clearContext(); TestSecurityContextHolder.clearContext();
this.context.close(); this.context.close();
} }

View File

@ -70,7 +70,7 @@ class MeterRegistryConfigurerTests {
private Config mockConfig; private Config mockConfig;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.mockRegistry.config()).willReturn(this.mockConfig); given(this.mockRegistry.config()).willReturn(this.mockConfig);
} }

View File

@ -50,7 +50,7 @@ class RabbitHealthIndicatorTests {
private Channel channel; private Channel channel;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.rabbitTemplate.execute(any())).willAnswer((invocation) -> { given(this.rabbitTemplate.execute(any())).willAnswer((invocation) -> {
ChannelCallback<?> callback = invocation.getArgument(0); ChannelCallback<?> callback = invocation.getArgument(0);

View File

@ -64,7 +64,7 @@ class ElasticsearchHealthIndicatorTests {
private ElasticsearchHealthIndicator indicator; private ElasticsearchHealthIndicator indicator;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.client.admin()).willReturn(this.admin); given(this.client.admin()).willReturn(this.admin);
given(this.admin.cluster()).willReturn(this.cluster); given(this.admin.cluster()).willReturn(this.cluster);

View File

@ -52,7 +52,7 @@ class DiscoveredOperationsFactoryTests {
private List<OperationInvokerAdvisor> invokerAdvisors; private List<OperationInvokerAdvisor> invokerAdvisors;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.parameterValueMapper = (parameter, value) -> value.toString(); this.parameterValueMapper = (parameter, value) -> value.toString();
this.invokerAdvisors = new ArrayList<>(); this.invokerAdvisors = new ArrayList<>();
this.factory = new TestDiscoveredOperationsFactory(this.parameterValueMapper, this.invokerAdvisors); this.factory = new TestDiscoveredOperationsFactory(this.parameterValueMapper, this.invokerAdvisors);

View File

@ -48,7 +48,7 @@ class ReflectiveOperationInvokerTests {
private ParameterValueMapper parameterValueMapper; private ParameterValueMapper parameterValueMapper;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.target = new Example(); this.target = new Example();
this.operationMethod = new OperationMethod(ReflectionUtils.findMethod(Example.class, "reverse", String.class), this.operationMethod = new OperationMethod(ReflectionUtils.findMethod(Example.class, "reverse", String.class),
OperationType.READ); OperationType.READ);

View File

@ -55,7 +55,7 @@ class CachingOperationInvokerAdvisorTests {
private CachingOperationInvokerAdvisor advisor; private CachingOperationInvokerAdvisor advisor;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.advisor = new CachingOperationInvokerAdvisor(this.timeToLive); this.advisor = new CachingOperationInvokerAdvisor(this.timeToLive);
} }

View File

@ -71,7 +71,7 @@ class JmxEndpointExporterTests {
private JmxEndpointExporter exporter; private JmxEndpointExporter exporter;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.exporter = new JmxEndpointExporter(this.mBeanServer, this.objectNameFactory, this.responseMapper, this.exporter = new JmxEndpointExporter(this.mBeanServer, this.objectNameFactory, this.responseMapper,
this.endpoints); this.endpoints);

View File

@ -61,7 +61,7 @@ class ServletEndpointRegistrarTests {
private ArgumentCaptor<Servlet> servlet; private ArgumentCaptor<Servlet> servlet;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.servletContext.addServlet(any(String.class), any(Servlet.class))).willReturn(this.dynamic); given(this.servletContext.addServlet(any(String.class), any(Servlet.class))).willReturn(this.dynamic);
} }

View File

@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class EnvironmentEndpointTests { class EnvironmentEndpointTests {
@AfterEach @AfterEach
public void close() { void close() {
System.clearProperty("VCAP_SERVICES"); System.clearProperty("VCAP_SERVICES");
} }

View File

@ -37,7 +37,7 @@ class EnvironmentEndpointWebIntegrationTests {
private WebTestClient client; private WebTestClient client;
@BeforeEach @BeforeEach
public void prepareEnvironment(ConfigurableApplicationContext context, WebTestClient client) { void prepareEnvironment(ConfigurableApplicationContext context, WebTestClient client) {
TestPropertyValues.of("foo:bar", "fool:baz").applyTo(context); TestPropertyValues.of("foo:bar", "fool:baz").applyTo(context);
this.client = client; this.client = client;
this.context = context; this.context = context;

View File

@ -47,7 +47,7 @@ class CompositeHealthIndicatorTests {
private HealthIndicator two; private HealthIndicator two;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build());
given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build());

View File

@ -42,7 +42,7 @@ class DefaultHealthIndicatorRegistryTests {
private DefaultHealthIndicatorRegistry registry; private DefaultHealthIndicatorRegistry registry;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build()); given(this.one.health()).willReturn(new Health.Builder().unknown().withDetail("1", "1").build());
given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build()); given(this.two.health()).willReturn(new Health.Builder().unknown().withDetail("2", "2").build());
this.registry = new DefaultHealthIndicatorRegistry(); this.registry = new DefaultHealthIndicatorRegistry();

View File

@ -43,7 +43,7 @@ class DefaultReactiveHealthIndicatorRegistryTests {
private DefaultReactiveHealthIndicatorRegistry registry; private DefaultReactiveHealthIndicatorRegistry registry;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
given(this.one.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("1", "1").build())); given(this.one.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("1", "1").build()));
given(this.two.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("2", "2").build())); given(this.two.health()).willReturn(Mono.just(new Health.Builder().unknown().withDetail("2", "2").build()));
this.registry = new DefaultReactiveHealthIndicatorRegistry(); this.registry = new DefaultReactiveHealthIndicatorRegistry();

View File

@ -35,7 +35,7 @@ class OrderedHealthAggregatorTests {
private OrderedHealthAggregator healthAggregator; private OrderedHealthAggregator healthAggregator;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.healthAggregator = new OrderedHealthAggregator(); this.healthAggregator = new OrderedHealthAggregator();
} }

View File

@ -44,7 +44,7 @@ class IntegrationGraphEndpointTests {
private IntegrationGraphEndpoint integrationGraphEndpoint; private IntegrationGraphEndpoint integrationGraphEndpoint;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
} }

View File

@ -51,14 +51,14 @@ class DataSourceHealthIndicatorTests {
private SingleConnectionDataSource dataSource; private SingleConnectionDataSource dataSource;
@BeforeEach @BeforeEach
public void init() { void init() {
EmbeddedDatabaseConnection db = EmbeddedDatabaseConnection.HSQL; EmbeddedDatabaseConnection db = EmbeddedDatabaseConnection.HSQL;
this.dataSource = new SingleConnectionDataSource(db.getUrl("testdb") + ";shutdown=true", "sa", "", false); this.dataSource = new SingleConnectionDataSource(db.getUrl("testdb") + ";shutdown=true", "sa", "", false);
this.dataSource.setDriverClassName(db.getDriverClassName()); this.dataSource.setDriverClassName(db.getDriverClassName());
} }
@AfterEach @AfterEach
public void close() { void close() {
if (this.dataSource != null) { if (this.dataSource != null) {
this.dataSource.destroy(); this.dataSource.destroy();
} }

View File

@ -50,7 +50,7 @@ class LogFileWebEndpointTests {
private File logFile; private File logFile;
@BeforeEach @BeforeEach
public void before(@TempDir Path temp) throws IOException { void before(@TempDir Path temp) throws IOException {
this.logFile = Files.createTempFile(temp, "junit", null).toFile(); this.logFile = Files.createTempFile(temp, "junit", null).toFile();
FileCopyUtils.copy("--TEST--".getBytes(), this.logFile); FileCopyUtils.copy("--TEST--".getBytes(), this.logFile);
} }

View File

@ -47,8 +47,7 @@ class LogFileWebEndpointWebIntegrationTests {
private File logFile; private File logFile;
@BeforeEach @BeforeEach
public void setUp(@TempDir File temp, WebTestClient client, ConfigurableApplicationContext context) void setUp(@TempDir File temp, WebTestClient client, ConfigurableApplicationContext context) throws IOException {
throws IOException {
this.logFile = new File(temp, "test.log"); this.logFile = new File(temp, "test.log");
this.client = client; this.client = client;
this.context = context; this.context = context;

View File

@ -59,7 +59,7 @@ class LoggersEndpointWebIntegrationTests {
@BeforeEach @BeforeEach
@AfterEach @AfterEach
public void resetMocks(ConfigurableApplicationContext context, WebTestClient client) { void resetMocks(ConfigurableApplicationContext context, WebTestClient client) {
this.client = client; this.client = client;
this.loggingSystem = context.getBean(LoggingSystem.class); this.loggingSystem = context.getBean(LoggingSystem.class);
Mockito.reset(this.loggingSystem); Mockito.reset(this.loggingSystem);

View File

@ -52,7 +52,7 @@ class MailHealthIndicatorTests {
private MailHealthIndicator indicator; private MailHealthIndicator indicator;
@BeforeEach @BeforeEach
public void setup() { void setup() {
Session session = Session.getDefaultInstance(new Properties()); Session session = Session.getDefaultInstance(new Properties());
session.addProvider(new Provider(Type.TRANSPORT, "success", SuccessTransport.class.getName(), "Test", "1.0.0")); session.addProvider(new Provider(Type.TRANSPORT, "success", SuccessTransport.class.getName(), "Test", "1.0.0"));
this.mailSender = mock(JavaMailSenderImpl.class); this.mailSender = mock(JavaMailSenderImpl.class);

View File

@ -45,7 +45,7 @@ class HeapDumpWebEndpointWebIntegrationTests {
private TestHeapDumpWebEndpoint endpoint; private TestHeapDumpWebEndpoint endpoint;
@BeforeEach @BeforeEach
public void configureEndpoint(ApplicationContext context) { void configureEndpoint(ApplicationContext context) {
this.endpoint = context.getBean(TestHeapDumpWebEndpoint.class); this.endpoint = context.getBean(TestHeapDumpWebEndpoint.class);
this.endpoint.setAvailable(true); this.endpoint.setAvailable(true);
} }

View File

@ -72,7 +72,7 @@ class PrometheusPushGatewayManagerTests {
private ScheduledFuture<Object> future; private ScheduledFuture<Object> future;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.scheduler = mockScheduler(TaskScheduler.class); this.scheduler = mockScheduler(TaskScheduler.class);
} }

View File

@ -54,7 +54,7 @@ class MetricsRestTemplateCustomizerTests {
private MetricsRestTemplateCustomizer customizer; private MetricsRestTemplateCustomizer customizer;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock()); this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
this.restTemplate = new RestTemplate(); this.restTemplate = new RestTemplate();
this.mockServer = MockRestServiceServer.createServer(this.restTemplate); this.mockServer = MockRestServiceServer.createServer(this.restTemplate);

View File

@ -50,7 +50,7 @@ class DefaultWebClientExchangeTagsProviderTests {
private ClientResponse response; private ClientResponse response;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot")) this.request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE, "https://example.org/projects/{project}").build(); .attribute(URI_TEMPLATE_ATTRIBUTE, "https://example.org/projects/{project}").build();
this.response = mock(ClientResponse.class); this.response = mock(ClientResponse.class);

View File

@ -38,7 +38,7 @@ class MetricsWebClientCustomizerTests {
private WebClient.Builder clientBuilder; private WebClient.Builder clientBuilder;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.customizer = new MetricsWebClientCustomizer(mock(MeterRegistry.class), this.customizer = new MetricsWebClientCustomizer(mock(MeterRegistry.class),
mock(WebClientExchangeTagsProvider.class), "test", null); mock(WebClientExchangeTagsProvider.class), "test", null);
this.clientBuilder = WebClient.builder(); this.clientBuilder = WebClient.builder();

View File

@ -60,7 +60,7 @@ class MetricsWebClientFilterFunctionTests {
private ExchangeFunction exchange; private ExchangeFunction exchange;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock()); this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, new MockClock());
this.filterFunction = new MetricsWebClientFilterFunction(this.registry, this.filterFunction = new MetricsWebClientFilterFunction(this.registry,
new DefaultWebClientExchangeTagsProvider(), "http.client.requests", AutoTimer.ENABLED); new DefaultWebClientExchangeTagsProvider(), "http.client.requests", AutoTimer.ENABLED);

View File

@ -48,7 +48,7 @@ class WebClientExchangeTagsTests {
private ClientResponse response; private ClientResponse response;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot")) this.request = ClientRequest.create(HttpMethod.GET, URI.create("https://example.org/projects/spring-boot"))
.attribute(URI_TEMPLATE_ATTRIBUTE, "https://example.org/projects/{project}").build(); .attribute(URI_TEMPLATE_ATTRIBUTE, "https://example.org/projects/{project}").build();
this.response = mock(ClientResponse.class); this.response = mock(ClientResponse.class);

View File

@ -47,7 +47,7 @@ class MetricsWebFilterTests {
private MetricsWebFilter webFilter; private MetricsWebFilter webFilter;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockClock clock = new MockClock(); MockClock clock = new MockClock();
this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock); this.registry = new SimpleMeterRegistry(SimpleConfig.DEFAULT, clock);
this.webFilter = new MetricsWebFilter(this.registry, new DefaultWebFluxTagsProvider(), REQUEST_METRICS_NAME, this.webFilter = new MetricsWebFilter(this.registry, new DefaultWebFluxTagsProvider(), REQUEST_METRICS_NAME,

View File

@ -45,7 +45,7 @@ class WebFluxTagsTests {
private PathPatternParser parser = new PathPatternParser(); private PathPatternParser parser = new PathPatternParser();
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get("")); this.exchange = MockServerWebExchange.from(MockServerHttpRequest.get(""));
} }

View File

@ -79,7 +79,7 @@ class LongTaskTimingHandlerInterceptorTests {
private MockMvc mvc; private MockMvc mvc;
@BeforeEach @BeforeEach
public void setUpMockMvc() { void setUpMockMvc() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build(); this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
} }

View File

@ -68,7 +68,7 @@ class WebMvcMetricsFilterAutoTimedTests {
private WebMvcMetricsFilter filter; private WebMvcMetricsFilter filter;
@BeforeEach @BeforeEach
public void setupMockMvc() { void setupMockMvc() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).addFilters(this.filter).build(); this.mvc = MockMvcBuilders.webAppContextSetup(this.context).addFilters(this.filter).build();
} }

View File

@ -121,7 +121,7 @@ class WebMvcMetricsFilterTests {
private CyclicBarrier completableFutureBarrier; private CyclicBarrier completableFutureBarrier;
@BeforeEach @BeforeEach
public void setupMockMvc() { void setupMockMvc() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context) this.mvc = MockMvcBuilders.webAppContextSetup(this.context)
.addFilters(this.filter, new RedirectAndNotFoundFilter()).build(); .addFilters(this.filter, new RedirectAndNotFoundFilter()).build();
} }

View File

@ -72,7 +72,7 @@ class WebMvcMetricsIntegrationTests {
private MockMvc mvc; private MockMvc mvc;
@BeforeEach @BeforeEach
public void setupMockMvc() { void setupMockMvc() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).addFilters(this.filter).build(); this.mvc = MockMvcBuilders.webAppContextSetup(this.context).addFilters(this.filter).build();
} }

View File

@ -41,7 +41,7 @@ class MongoHealthIndicatorTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class Neo4jHealthIndicatorTests {
private Neo4jHealthIndicator neo4jHealthIndicator; private Neo4jHealthIndicator neo4jHealthIndicator;
@BeforeEach @BeforeEach
public void before() { void before() {
this.session = mock(Session.class); this.session = mock(Session.class);
SessionFactory sessionFactory = mock(SessionFactory.class); SessionFactory sessionFactory = mock(SessionFactory.class);
given(sessionFactory.openSession()).willReturn(this.session); given(sessionFactory.openSession()).willReturn(this.session);

View File

@ -49,7 +49,7 @@ class AuthenticationAuditListenerTests {
private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class);
@BeforeEach @BeforeEach
public void init() { void init() {
this.listener.setApplicationEventPublisher(this.publisher); this.listener.setApplicationEventPublisher(this.publisher);
} }

View File

@ -46,7 +46,7 @@ class AuthorizationAuditListenerTests {
private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class); private final ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class);
@BeforeEach @BeforeEach
public void init() { void init() {
this.listener.setApplicationEventPublisher(this.publisher); this.listener.setApplicationEventPublisher(this.publisher);
} }

View File

@ -44,7 +44,7 @@ class SolrHealthIndicatorTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -49,7 +49,7 @@ class DiskSpaceHealthIndicatorTests {
private HealthIndicator healthIndicator; private HealthIndicator healthIndicator;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
given(this.fileMock.exists()).willReturn(true); given(this.fileMock.exists()).willReturn(true);
given(this.fileMock.canRead()).willReturn(true); given(this.fileMock.canRead()).willReturn(true);

View File

@ -43,7 +43,7 @@ class ServerWebExchangeTraceableRequestTests {
private ServerHttpRequest request; private ServerHttpRequest request;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
this.exchange = mock(ServerWebExchange.class); this.exchange = mock(ServerWebExchange.class);
this.request = mock(ServerHttpRequest.class); this.request = mock(ServerHttpRequest.class);
given(this.exchange.getRequest()).willReturn(this.request); given(this.exchange.getRequest()).willReturn(this.request);

View File

@ -32,7 +32,7 @@ class TraceableHttpServletRequestTests {
private MockHttpServletRequest request; private MockHttpServletRequest request;
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.request = new MockHttpServletRequest("GET", "/script"); this.request = new MockHttpServletRequest("GET", "/script");
} }

View File

@ -45,7 +45,7 @@ class AutoConfigurationExcludeFilterTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void cleanUp() { void cleanUp() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -61,7 +61,7 @@ class AutoConfigurationImportSelectorTests {
private List<AutoConfigurationImportFilter> filters = new ArrayList<>(); private List<AutoConfigurationImportFilter> filters = new ArrayList<>();
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.importSelector.setBeanFactory(this.beanFactory); this.importSelector.setBeanFactory(this.beanFactory);
this.importSelector.setEnvironment(this.environment); this.importSelector.setEnvironment(this.environment);

View File

@ -38,7 +38,7 @@ class AutoConfigurationReproTests {
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
@AfterEach @AfterEach
public void cleanup() { void cleanup() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -78,7 +78,7 @@ class AutoConfigurationSorterTests {
private AutoConfigurationMetadata autoConfigurationMetadata = mock(AutoConfigurationMetadata.class); private AutoConfigurationMetadata autoConfigurationMetadata = mock(AutoConfigurationMetadata.class);
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.sorter = new AutoConfigurationSorter(new SkipCycleMetadataReaderFactory(), this.autoConfigurationMetadata); this.sorter = new AutoConfigurationSorter(new SkipCycleMetadataReaderFactory(), this.autoConfigurationMetadata);
} }

View File

@ -58,7 +58,7 @@ class ImportAutoConfigurationImportSelectorTests {
private Environment environment; private Environment environment;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.importSelector.setBeanFactory(this.beanFactory); this.importSelector.setBeanFactory(this.beanFactory);
this.importSelector.setEnvironment(this.environment); this.importSelector.setEnvironment(this.environment);

View File

@ -73,7 +73,7 @@ class JobLauncherCommandLineRunnerTests {
private Step step; private Step step;
@BeforeEach @BeforeEach
public void init() { void init() {
this.context.register(BatchConfiguration.class); this.context.register(BatchConfiguration.class);
this.context.refresh(); this.context.refresh();
JobRepository jobRepository = this.context.getBean(JobRepository.class); JobRepository jobRepository = this.context.getBean(JobRepository.class);
@ -90,7 +90,7 @@ class JobLauncherCommandLineRunnerTests {
} }
@AfterEach @AfterEach
public void closeContext() { void closeContext() {
this.context.close(); this.context.close();
} }

View File

@ -45,7 +45,7 @@ class ConditionEvaluationReportAutoConfigurationImportListenerTests {
private final ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory(); private final ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.listener = new ConditionEvaluationReportAutoConfigurationImportListener(); this.listener = new ConditionEvaluationReportAutoConfigurationImportListener();
this.listener.setBeanFactory(this.beanFactory); this.listener.setBeanFactory(this.beanFactory);
} }

View File

@ -78,7 +78,7 @@ class ConditionEvaluationReportTests {
private ConditionOutcome outcome3; private ConditionOutcome outcome3;
@BeforeEach @BeforeEach
public void setup() { void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
this.beanFactory = new DefaultListableBeanFactory(); this.beanFactory = new DefaultListableBeanFactory();
this.report = ConditionEvaluationReport.get(this.beanFactory); this.report = ConditionEvaluationReport.get(this.beanFactory);

View File

@ -54,13 +54,13 @@ class ConditionalOnJndiTests {
private MockableOnJndi condition = new MockableOnJndi(); private MockableOnJndi condition = new MockableOnJndi();
@BeforeEach @BeforeEach
public void setupThreadContextClassLoader() { void setupThreadContextClassLoader() {
this.threadContextClassLoader = Thread.currentThread().getContextClassLoader(); this.threadContextClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(new JndiPropertiesHidingClassLoader(getClass().getClassLoader())); Thread.currentThread().setContextClassLoader(new JndiPropertiesHidingClassLoader(getClass().getClassLoader()));
} }
@AfterEach @AfterEach
public void close() { void close() {
TestableInitialContextFactory.clearAll(); TestableInitialContextFactory.clearAll();
if (this.initialContextFactory != null) { if (this.initialContextFactory != null) {
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, this.initialContextFactory); System.setProperty(Context.INITIAL_CONTEXT_FACTORY, this.initialContextFactory);

View File

@ -52,7 +52,7 @@ class ConditionalOnPropertyTests {
private ConfigurableEnvironment environment = new StandardEnvironment(); private ConfigurableEnvironment environment = new StandardEnvironment();
@AfterEach @AfterEach
public void tearDown() { void tearDown() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -38,7 +38,7 @@ class ConditionalOnSingleCandidateTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -46,7 +46,7 @@ class ConditionalOnWebApplicationTests {
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
@AfterEach @AfterEach
public void closeContext() { void closeContext() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -40,7 +40,7 @@ class OnClassConditionAutoConfigurationImportFilterTests {
private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); private DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
@BeforeEach @BeforeEach
public void setup() { void setup() {
this.filter.setBeanClassLoader(getClass().getClassLoader()); this.filter.setBeanClassLoader(getClass().getClassLoader());
this.filter.setBeanFactory(this.beanFactory); this.filter.setBeanFactory(this.beanFactory);
} }

View File

@ -38,7 +38,7 @@ class ResourceConditionTests {
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
@AfterEach @AfterEach
public void tearDown() { void tearDown() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -38,7 +38,7 @@ class ConfigurationPropertiesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void tearDown() { void tearDown() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -39,7 +39,7 @@ class PropertyPlaceholderAutoConfigurationTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -48,7 +48,7 @@ class PersistenceExceptionTranslationAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class CassandraDataAutoConfigurationIntegrationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
this.context = new AnnotationConfigApplicationContext(); this.context = new AnnotationConfigApplicationContext();
TestPropertyValues TestPropertyValues
.of("spring.data.cassandra.port=" + cassandra.getFirstMappedPort(), .of("spring.data.cassandra.port=" + cassandra.getFirstMappedPort(),
@ -59,7 +59,7 @@ class CassandraDataAutoConfigurationIntegrationTests {
} }
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -55,7 +55,7 @@ class CassandraDataAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -49,7 +49,7 @@ class CassandraReactiveDataAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -58,7 +58,7 @@ class CouchbaseDataAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class CouchbaseReactiveAndImperativeRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -58,7 +58,7 @@ class CouchbaseReactiveDataAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -46,7 +46,7 @@ class CouchbaseReactiveRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -44,7 +44,7 @@ class CouchbaseRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -51,12 +51,12 @@ class ElasticsearchAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
System.setProperty("es.set.netty.runtime.available.processors", "false"); System.setProperty("es.set.netty.runtime.available.processors", "false");
} }
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -56,12 +56,12 @@ class ElasticsearchDataAutoConfigurationTests {
ReactiveRestClientAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class)); ReactiveRestClientAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class));
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
System.setProperty("es.set.netty.runtime.available.processors", "false"); System.setProperty("es.set.netty.runtime.available.processors", "false");
} }
@AfterEach @AfterEach
public void tearDown() { void tearDown() {
System.clearProperty("es.set.netty.runtime.available.processors"); System.clearProperty("es.set.netty.runtime.available.processors");
} }

View File

@ -46,7 +46,7 @@ class JpaWebAutoConfigurationTests {
private AnnotationConfigServletWebApplicationContext context; private AnnotationConfigServletWebApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -43,7 +43,7 @@ class LdapRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -55,7 +55,7 @@ class MixedMongoRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class MongoReactiveAndBlockingRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -54,7 +54,7 @@ class MixedNeo4jRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -42,7 +42,7 @@ class Neo4jPropertiesTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -50,7 +50,7 @@ class Neo4jRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -50,12 +50,12 @@ class RedisRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@BeforeEach @BeforeEach
public void setUp() { void setUp() {
TestPropertyValues.of("spring.redis.port=" + redis.getFirstMappedPort()).applyTo(this.context.getEnvironment()); TestPropertyValues.of("spring.redis.port=" + redis.getFirstMappedPort()).applyTo(this.context.getEnvironment());
} }
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -58,7 +58,7 @@ class RepositoryRestMvcAutoConfigurationTests {
private AnnotationConfigServletWebApplicationContext context; private AnnotationConfigServletWebApplicationContext context;
@AfterEach @AfterEach
public void tearDown() { void tearDown() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -47,7 +47,7 @@ class SolrRepositoriesAutoConfigurationTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
this.context.close(); this.context.close();
} }

View File

@ -41,7 +41,7 @@ class EntityScanPackagesTests {
private AnnotationConfigApplicationContext context; private AnnotationConfigApplicationContext context;
@AfterEach @AfterEach
public void cleanup() { void cleanup() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -60,7 +60,7 @@ class FreeMarkerAutoConfigurationServletIntegrationTests {
private AnnotationConfigServletWebApplicationContext context; private AnnotationConfigServletWebApplicationContext context;
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

View File

@ -59,12 +59,12 @@ class GroovyTemplateAutoConfigurationTests {
private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext();
@BeforeEach @BeforeEach
public void setupContext() { void setupContext() {
this.context.setServletContext(new MockServletContext()); this.context.setServletContext(new MockServletContext());
} }
@AfterEach @AfterEach
public void close() { void close() {
LocaleContextHolder.resetLocaleContext(); LocaleContextHolder.resetLocaleContext();
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();

View File

@ -51,12 +51,12 @@ class H2ConsoleAutoConfigurationTests {
private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext(); private AnnotationConfigServletWebApplicationContext context = new AnnotationConfigServletWebApplicationContext();
@BeforeEach @BeforeEach
public void setupContext() { void setupContext() {
this.context.setServletContext(new MockServletContext()); this.context.setServletContext(new MockServletContext());
} }
@AfterEach @AfterEach
public void close() { void close() {
if (this.context != null) { if (this.context != null) {
this.context.close(); this.context.close();
} }

Some files were not shown because too many files have changed in this diff Show More