<commit_before>/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.stubbing.defaultanswers;

import java.io.Serializable;

import org.mockito.internal.MockitoCore;
import org.mockito.internal.creation.MockSettingsImpl;
import org.mockito.internal.creation.jmock.ClassImposterizer;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

public class ReturnsMocks implements Answer<Object>, Serializable {
    
    private static final long serialVersionUID = -6755257986994634579L;
    private MockitoCore mockitoCore = new MockitoCore();
    private Answer<Object> delegate = new ReturnsMoreEmptyValues();
    
    public Object answer(InvocationOnMock invocation) throws Throwable {
        Object ret = delegate.answer(invocation);
        if (ret != null) {
            return ret;
        }
            
        return returnValueFor(invocation.getMethod().getReturnType());
    }

    Object returnValueFor(Class<?> clazz) {
        if (!mockitoCore.isTypeMockable(clazz)) {
            return null;
        }<commit_msg>Remove unused import<commit_after>/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.stubbing.defaultanswers;

import java.io.Serializable;

import org.mockito.internal.MockitoCore;
import org.mockito.internal.creation.MockSettingsImpl;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

public class ReturnsMocks implements Answer<Object>, Serializable {
    
    private static final long serialVersionUID = -6755257986994634579L;
    private MockitoCore mockitoCore = new MockitoCore();
    private Answer<Object> delegate = new ReturnsMoreEmptyValues();
    
    public Object answer(InvocationOnMock invocation) throws Throwable {
        Object ret = delegate.answer(invocation);
        if (ret != null) {
            return ret;
        }
            
        return returnValueFor(invocation.getMethod().getReturnType());
    }

    Object returnValueFor(Class<?> clazz) {
        if (!mockitoCore.isTypeMockable(clazz)) {
            return null;
        }
{'fraction_non_alphanumeric': 0.08618391825855176, 'fraction_numerical': 0.020435362061306087, 'mean_word_length': 3.5403225806451615, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3402951', 'n_tokens_mistral': 649, 'n_tokens_neox': 614, 'n_words': 154}