mockit.internal.util.DefaultValues Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmockit Show documentation
Show all versions of jmockit Show documentation
JMockit is a Java toolkit for developer (unit/integration) testing.
It contains mocking APIs and other tools, supporting both JUnit and TestNG.
The mocking APIs allow all kinds of Java code, without testability restrictions, to be tested
in isolation from selected dependencies.
/*
* Copyright (c) 2006-2011 Rogério Liesenfeld
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
package mockit.internal.util;
import java.lang.reflect.*;
import java.util.*;
import mockit.external.asm.Type;
import static java.util.Collections.*;
/**
* Provides default values for each type, typically used for returning default values according to
* method return types.
*/
public final class DefaultValues
{
private DefaultValues() {}
private static final Map TYPE_DESC_TO_VALUE_MAP = new HashMap()
{
{
put("Z", false);
put("C", '\0');
put("B", (byte) 0);
put("S", (short) 0);
put("I", 0);
put("F", 0.0F);
put("J", 0L);
put("D", 0.0);
put("Ljava/util/Collection;", Collections.emptyList());
put("Ljava/util/List;", Collections.emptyList());
put("Ljava/util/Set;", Collections.emptySet());
put("Ljava/util/SortedSet;", unmodifiableSortedSet(new TreeSet