mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 03:43:21 +08:00
Remove superflous if
in MockitoPostProcessor
The `if` in registerSpies() is not required as it's covered by the Assert check. Closes gh-5889
This commit is contained in:
parent
6cdbdf9ad3
commit
29898c73d3
@ -246,12 +246,10 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||
|
||||
private void registerSpies(SpyDefinition definition, Field field,
|
||||
String[] existingBeans) {
|
||||
if (field != null) {
|
||||
Assert.state(field == null || existingBeans.length == 1,
|
||||
"Unable to register spy bean " + definition.getClassToSpy().getName()
|
||||
+ " expected a single existing bean to replace but found "
|
||||
+ new TreeSet<String>(Arrays.asList(existingBeans)));
|
||||
}
|
||||
Assert.state(field == null || existingBeans.length == 1,
|
||||
"Unable to register spy bean " + definition.getClassToSpy().getName()
|
||||
+ " expected a single existing bean to replace but found "
|
||||
+ new TreeSet<String>(Arrays.asList(existingBeans)));
|
||||
for (String beanName : existingBeans) {
|
||||
registerSpy(definition, field, beanName);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user