return type.getName().startsWith("java.") && Modifier.isFinal(type.getModifiers());
}
private static <T> MockData<T> createMethodInvocationControl(final String mockName, Class<T> type,
Method[] methods, boolean isSpy, Object delegator, MockSettings mockSettings) {
final MockSettingsImpl settings;
if (mockSettings == null) {
settings = (MockSettingsImpl) Mockito.withSettings();
} else {
settings = (MockSettingsImpl) mockSettings;
}
if (isSpy) {
settings.defaultAnswer(Mockito.CALLS_REAL_METHODS);
}
settings.initiateMockName(type);
MockHandler<T> mockHandler = new MockHandler<T>(settings);
MethodInterceptorFilter filter = new MethodInterceptorFilter(mockHandler, settings);
final T mock = (T) ClassImposterizer.INSTANCE.imposterise(filter, type);
final MockitoMethodInvocationControl invocationControl = new MockitoMethodInvocationControl(filter,
isSpy && delegator == null ? new Object() : delegator, mock, methods);