Commit ef9f1d39 authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Remove redundant MockitoAnnotations.initMocks()

See gh-20601
parent 70aa7887
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.endpoint; package org.springframework.boot.actuate.autoconfigure.endpoint;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.actuate.endpoint.EndpointFilter; import org.springframework.boot.actuate.endpoint.EndpointFilter;
import org.springframework.boot.actuate.endpoint.EndpointId; import org.springframework.boot.actuate.endpoint.EndpointId;
...@@ -40,11 +38,6 @@ class ExposeExcludePropertyEndpointFilterTests { ...@@ -40,11 +38,6 @@ class ExposeExcludePropertyEndpointFilterTests {
private ExposeExcludePropertyEndpointFilter<?> filter; private ExposeExcludePropertyEndpointFilter<?> filter;
@BeforeEach
void setup() {
MockitoAnnotations.initMocks(this);
}
@Test @Test
void createWhenEndpointTypeIsNullShouldThrowException() { void createWhenEndpointTypeIsNullShouldThrowException() {
assertThatIllegalArgumentException() assertThatIllegalArgumentException()
......
...@@ -20,9 +20,7 @@ import java.util.Collections; ...@@ -20,9 +20,7 @@ import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.actuate.endpoint.SecurityContext; import org.springframework.boot.actuate.endpoint.SecurityContext;
import org.springframework.boot.actuate.endpoint.http.ApiVersion; import org.springframework.boot.actuate.endpoint.http.ApiVersion;
...@@ -59,11 +57,6 @@ abstract class HealthEndpointSupportTests<R extends ContributorRegistry<C>, C, T ...@@ -59,11 +57,6 @@ abstract class HealthEndpointSupportTests<R extends ContributorRegistry<C>, C, T
this.registry = createRegistry(); this.registry = createRegistry();
} }
@BeforeEach
void setup() {
MockitoAnnotations.initMocks(this);
}
@Test @Test
void createWhenRegistryIsNullThrowsException() { void createWhenRegistryIsNullThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> create(null, this.groups)) assertThatIllegalArgumentException().isThrownBy(() -> create(null, this.groups))
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -24,7 +24,6 @@ import java.util.Set; ...@@ -24,7 +24,6 @@ import java.util.Set;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactory;
...@@ -62,7 +61,6 @@ class AutoConfigurationImportSelectorTests { ...@@ -62,7 +61,6 @@ class AutoConfigurationImportSelectorTests {
@BeforeEach @BeforeEach
void setup() { void setup() {
MockitoAnnotations.initMocks(this);
this.importSelector.setBeanFactory(this.beanFactory); this.importSelector.setBeanFactory(this.beanFactory);
this.importSelector.setEnvironment(this.environment); this.importSelector.setEnvironment(this.environment);
this.importSelector.setResourceLoader(new DefaultResourceLoader()); this.importSelector.setResourceLoader(new DefaultResourceLoader());
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
package org.springframework.boot.test.mock.mockito; package org.springframework.boot.test.mock.mockito;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.ContextCustomizer; import org.springframework.test.context.ContextCustomizer;
...@@ -33,11 +31,6 @@ class MockitoContextCustomizerFactoryTests { ...@@ -33,11 +31,6 @@ class MockitoContextCustomizerFactoryTests {
private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory(); private final MockitoContextCustomizerFactory factory = new MockitoContextCustomizerFactory();
@BeforeEach
void setup() {
MockitoAnnotations.initMocks(this);
}
@Test @Test
void getContextCustomizerWithoutAnnotationReturnsCustomizer() { void getContextCustomizerWithoutAnnotationReturnsCustomizer() {
ContextCustomizer customizer = this.factory.createContextCustomizer(NoMockBeanAnnotation.class, null); ContextCustomizer customizer = this.factory.createContextCustomizer(NoMockBeanAnnotation.class, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment