All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jasmine.framework.test.mockito.MockUtil Maven / Gradle / Ivy

There is a newer version: 1.3.8
Show newest version
package jasmine.framework.test.mockito;

import jasmine.framework.common.util.CheckUtil;
import org.mockito.Mockito;

/**
 * 

* 模拟工具类。 *

* * @author mh.z */ public class MockUtil { /** * 模拟对象 * * @param classToMock * @param mock * @param * @return */ public static T mock(Class classToMock, CustomMock mock) { CheckUtil.notNull(classToMock, "classToMock null"); CustomAnswer answer = new CustomAnswer<>(); T target = Mockito.mock(classToMock, answer); if (mock != null) { answer.mock(target, mock); } return target; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy