Commit 29898c73 authored by Johnny Lim's avatar Johnny Lim Committed by Phillip Webb

Remove superflous `if` in MockitoPostProcessor

The `if` in registerSpies() is not required as it's covered by the
Assert check.

Closes gh-5889
parent 6cdbdf9a
......@@ -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);
}
......
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