本文整理汇总了Java中org.powermock.reflect.internal.WhiteboxImpl.setInternalState方法的典型用法代码示例。如果您正苦于以下问题:Java WhiteboxImpl.setInternalState方法的具体用法?Java WhiteboxImpl.setInternalState怎么用?Java WhiteboxImpl.setInternalState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.powermock.reflect.internal.WhiteboxImpl
的用法示例。
在下文中一共展示了WhiteboxImpl.setInternalState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAclEntrySetMock
import org.powermock.reflect.internal.WhiteboxImpl; //导入方法依赖的package包/类
protected CloudAclEntrySet createAclEntrySetMock(String name) {
CloudAclEntrySet aclEntrySet = context.mock(CloudAclEntrySet.class, name);
// The next part we have to do because of the aclEntrySet.equals method which uses this,
// so we have to set this value in the mock or we get an NPE
WhiteboxImpl.setInternalState(aclEntrySet, "ownersLock", new ReentrantReadWriteLock());
return aclEntrySet;
}
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:8,代码来源:DefaultCloudFileSystemImplementationTest.java
示例2: useMockJAXBContext
import org.powermock.reflect.internal.WhiteboxImpl; //导入方法依赖的package包/类
protected void useMockJAXBContext(Object object, Class<?> jaxbClassToBeBound) throws Exception {
JAXBContext jaxbContext = JAXBContext.newInstance(jaxbClassToBeBound);
when(context.createMarshaller()).thenReturn(jaxbContext.createMarshaller());
when(context.createUnmarshaller()).thenReturn(jaxbContext.createUnmarshaller());
WhiteboxImpl.setInternalState(object, JAXBContext.class, context);
}
示例3: registerProxyFramework
import org.powermock.reflect.internal.WhiteboxImpl; //导入方法依赖的package包/类
/**
* Register a proxy framework.
*
* @param proxyFramework
* The proxy framework to register.
*/
public static void registerProxyFramework(ProxyFramework proxyFramework) {
WhiteboxImpl.setInternalState(WhiteboxImpl.class, proxyFramework);
}
示例4: setInternalState
import org.powermock.reflect.internal.WhiteboxImpl; //导入方法依赖的package包/类
/**
* Set the value of a field using reflection. This method will traverse the
* super class hierarchy until a field with name <tt>fieldName</tt> is
* found.
*
* @param object
* the object whose field to modify
* @param fieldName
* the name of the field
* @param value
* the new value of the field
*/
public static void setInternalState(Object object, String fieldName, Object value) {
WhiteboxImpl.setInternalState(object, fieldName, value);
}