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:
Johnny Lim 2016-05-08 19:42:05 +09:00 committed by Phillip Webb
parent 6cdbdf9ad3
commit 29898c73d3

View File

@ -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);
}