Skip to content

Commit 252c918

Browse files
committed
Merge pull request #20601 from dreis2211
* pr/20601: Remove redundant MockitoAnnotations.initMocks() Closes gh-20601
2 parents 70aa788 + ef9f1d3 commit 252c918

File tree

4 files changed

+3
-26
lines changed

4 files changed

+3
-26
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilterTests.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,9 +16,7 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint;
1818

19-
import org.junit.jupiter.api.BeforeEach;
2019
import org.junit.jupiter.api.Test;
21-
import org.mockito.MockitoAnnotations;
2220

2321
import org.springframework.boot.actuate.endpoint.EndpointFilter;
2422
import org.springframework.boot.actuate.endpoint.EndpointId;
@@ -40,11 +38,6 @@ class ExposeExcludePropertyEndpointFilterTests {
4038

4139
private ExposeExcludePropertyEndpointFilter<?> filter;
4240

43-
@BeforeEach
44-
void setup() {
45-
MockitoAnnotations.initMocks(this);
46-
}
47-
4841
@Test
4942
void createWhenEndpointTypeIsNullShouldThrowException() {
5043
assertThatIllegalArgumentException()

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointSupportTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import java.util.LinkedHashMap;
2121
import java.util.Map;
2222

23-
import org.junit.jupiter.api.BeforeEach;
2423
import org.junit.jupiter.api.Test;
25-
import org.mockito.MockitoAnnotations;
2624

2725
import org.springframework.boot.actuate.endpoint.SecurityContext;
2826
import org.springframework.boot.actuate.endpoint.http.ApiVersion;
@@ -59,11 +57,6 @@ abstract class HealthEndpointSupportTests<R extends ContributorRegistry<C>, C, T
5957
this.registry = createRegistry();
6058
}
6159

62-
@BeforeEach
63-
void setup() {
64-
MockitoAnnotations.initMocks(this);
65-
}
66-
6760
@Test
6861
void createWhenRegistryIsNullThrowsException() {
6962
assertThatIllegalArgumentException().isThrownBy(() -> create(null, this.groups))

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelectorTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
2424

2525
import org.junit.jupiter.api.BeforeEach;
2626
import org.junit.jupiter.api.Test;
27-
import org.mockito.MockitoAnnotations;
2827

2928
import org.springframework.beans.BeansException;
3029
import org.springframework.beans.factory.BeanFactory;
@@ -62,7 +61,6 @@ class AutoConfigurationImportSelectorTests {
6261

6362
@BeforeEach
6463
void setup() {
65-
MockitoAnnotations.initMocks(this);
6664
this.importSelector.setBeanFactory(this.beanFactory);
6765
this.importSelector.setEnvironment(this.environment);
6866
this.importSelector.setResourceLoader(new DefaultResourceLoader());

spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizerFactoryTests.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,9 +16,7 @@
1616

1717
package org.springframework.boot.test.mock.mockito;
1818

19-
import org.junit.jupiter.api.BeforeEach;
2019
import org.junit.jupiter.api.Test;
21-
import org.mockito.MockitoAnnotations;
2220

2321
import org.springframework.test.context.ContextCustomizer;
2422

@@ -33,11 +31,6 @@ class MockitoContextCustomizerFactoryTests {
3331

3432
private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory();
3533

36-
@BeforeEach
37-
void setup() {
38-
MockitoAnnotations.initMocks(this);
39-
}
40-
4134
@Test
4235
void getContextCustomizerWithoutAnnotationReturnsCustomizer() {
4336
ContextCustomizer customizer = this.factory.createContextCustomizer(NoMockBeanAnnotation.class, null);

0 commit comments

Comments
 (0)