Merge pull request #20601 from dreis2211

* pr/20601:
  Remove redundant MockitoAnnotations.initMocks()

Closes gh-20601
pull/20604/head
Stephane Nicoll 5 years ago
commit 252c918484

@ -1,5 +1,5 @@
/* /*
* 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 @@
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 {
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;
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
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))

@ -1,5 +1,5 @@
/* /*
* 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;
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 {
@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());

@ -1,5 +1,5 @@
/* /*
* 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 @@
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 {
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);

Loading…
Cancel
Save