org.mockito.internal.stubbing.defaultanswers.ReturnsMoreEmptyValues Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockito-core Show documentation
Show all versions of mockito-core Show documentation
Mockito mock objects library core API and implementation
/*
* 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 java.lang.reflect.Array;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
/**
* It's likely this implementation will be used by default by every Mockito 4.0.0 mock.
*
* Currently used only by {@link Mockito#RETURNS_SMART_NULLS}
*
* Current version of Mockito mocks by default use {@link ReturnsEmptyValues}
*
* -
* Returns appropriate primitive for primitive-returning methods
*
* -
* Returns consistent values for primitive wrapper classes (e.g. int-returning method returns 0 and Integer-returning method returns 0, too)
*
* -
* Returns empty collection for collection-returning methods (works for most commonly used collection types)
*
* -
* Returns empty array for array-returning methods
*
* -
* Returns "" for String-returning method
*
* -
* Returns description of mock for toString() method
*
* -
* Returns non-zero for Comparable#compareTo(T other) method (see issue 184)
*
* -
* Returns null for everything else
*
*
*/
public class ReturnsMoreEmptyValues implements Answer