blob: 9c414f3f910e77bd102c69dbafdbaabfe42172d4 [file] [log] [blame]
/*
* Copyright (c) 2016 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.creation.instance;
import org.mockito.creation.instance.Instantiator;
import org.mockito.mock.MockCreationSettings;
import org.mockito.plugins.InstantiatorProvider2;
public class DefaultInstantiatorProvider implements InstantiatorProvider2 {
private final static Instantiator INSTANCE = new ObjenesisInstantiator();
public Instantiator getInstantiator(MockCreationSettings<?> settings) {
if (settings != null && settings.getConstructorArgs() != null) {
return new ConstructorInstantiator(settings.getOuterClassInstance() != null, settings.getConstructorArgs());
} else {
return INSTANCE;
}
}
}