Polish “Remove or use unused method parameters”
Closes gh-11812
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -80,10 +79,9 @@ public class BasicJsonTester {
|
||||
* UTF-8.
|
||||
* @param resourceLoadClass the source class used when loading relative classpath
|
||||
* resources
|
||||
* @param type the type under test
|
||||
*/
|
||||
protected final void initialize(Class<?> resourceLoadClass, ResolvableType type) {
|
||||
this.initialize(resourceLoadClass, null, type);
|
||||
protected final void initialize(Class<?> resourceLoadClass) {
|
||||
this.initialize(resourceLoadClass, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,11 +89,9 @@ public class BasicJsonTester {
|
||||
* @param resourceLoadClass the source class used when loading relative classpath
|
||||
* resources
|
||||
* @param charset the charset used when loading relative classpath resources
|
||||
* @param type the type under test
|
||||
* @since 1.4.1
|
||||
*/
|
||||
protected final void initialize(Class<?> resourceLoadClass, Charset charset,
|
||||
ResolvableType type) {
|
||||
protected final void initialize(Class<?> resourceLoadClass, Charset charset) {
|
||||
if (this.loader == null) {
|
||||
this.loader = new JsonLoader(resourceLoadClass, charset);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -97,7 +97,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
|
||||
private Map<Definition, String> beanNameRegistry = new HashMap<>();
|
||||
|
||||
private Map<Field, RegisteredField> fieldRegistry = new HashMap<>();
|
||||
private Map<Field, String> fieldRegistry = new HashMap<>();
|
||||
|
||||
private Map<String, SpyDefinition> spies = new HashMap<>();
|
||||
|
||||
@@ -194,7 +194,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
this.mockitoBeans.add(mock);
|
||||
this.beanNameRegistry.put(definition, beanName);
|
||||
if (field != null) {
|
||||
this.fieldRegistry.put(field, new RegisteredField(definition, beanName));
|
||||
this.fieldRegistry.put(field, beanName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
this.spies.put(beanName, definition);
|
||||
this.beanNameRegistry.put(definition, beanName);
|
||||
if (field != null) {
|
||||
this.fieldRegistry.put(field, new RegisteredField(definition, beanName));
|
||||
this.fieldRegistry.put(field, beanName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,9 +370,9 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
}
|
||||
|
||||
private void postProcessField(Object bean, Field field) {
|
||||
RegisteredField registered = this.fieldRegistry.get(field);
|
||||
if (registered != null && StringUtils.hasLength(registered.getBeanName())) {
|
||||
inject(field, bean, registered.getBeanName());
|
||||
String beanName = this.fieldRegistry.get(field);
|
||||
if (StringUtils.hasText(beanName)) {
|
||||
inject(field, bean, beanName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,28 +511,4 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A registered field item.
|
||||
*/
|
||||
private static class RegisteredField {
|
||||
|
||||
private final Definition definition;
|
||||
|
||||
private final String beanName;
|
||||
|
||||
RegisteredField(Definition definition, String beanName) {
|
||||
this.definition = definition;
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public Definition getDefinition() {
|
||||
return this.definition;
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,12 +62,11 @@ class TestRestTemplateTestContextCustomizer implements ContextCustomizer {
|
||||
private void registerTestRestTemplate(ConfigurableApplicationContext context) {
|
||||
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
|
||||
if (beanFactory instanceof BeanDefinitionRegistry) {
|
||||
registerTestRestTemplate(context, (BeanDefinitionRegistry) context);
|
||||
registerTestRestTemplate((BeanDefinitionRegistry) context);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerTestRestTemplate(ConfigurableApplicationContext context,
|
||||
BeanDefinitionRegistry registry) {
|
||||
private void registerTestRestTemplate(BeanDefinitionRegistry registry) {
|
||||
RootBeanDefinition definition = new RootBeanDefinition(
|
||||
TestRestTemplateRegistrar.class);
|
||||
definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
|
||||
Reference in New Issue
Block a user