Java 类org.mockito.cglib.core.NamingPolicy 实例源码
项目:astor
文件:CGLIBHackerTest.java
@Test
public void shouldSetMockitoNamingPolicy() throws Exception {
//given
MockitoMethodProxy methodProxy = new MethodProxyBuilder().build();
//when
new CGLIBHacker().setMockitoNamingPolicy(methodProxy);
//then
Object realMethodProxy = Whitebox.invokeMethod(methodProxy, "getMethodProxy", new Object[0]);
Object createInfo = Whitebox.getInternalState(realMethodProxy, "createInfo");
NamingPolicy namingPolicy = (NamingPolicy) Whitebox.getInternalState(createInfo, "namingPolicy");
assertEquals(MockitoNamingPolicy.INSTANCE, namingPolicy);
}
项目:astor
文件:CGLIBHackerTest.java
@Test
public void shouldSetMockitoNamingPolicyEvenIfMethodProxyIsProxied() throws Exception {
//given
MockitoMethodProxy proxiedMethodProxy = spy(new MethodProxyBuilder().build());
//when
new CGLIBHacker().setMockitoNamingPolicy(proxiedMethodProxy);
//then
Object realMethodProxy = Whitebox.invokeMethod(proxiedMethodProxy, "getMethodProxy", new Object[0]);
Object createInfo = Whitebox.getInternalState(realMethodProxy, "createInfo");
NamingPolicy namingPolicy = (NamingPolicy) Whitebox.getInternalState(createInfo, "namingPolicy");
assertEquals(MockitoNamingPolicy.INSTANCE, namingPolicy);
}
项目:astor
文件:CGLIBHackerTest.java
@Test
public void shouldSetMockitoNamingPolicy() throws Exception {
//given
MockitoMethodProxy methodProxy = new MethodProxyBuilder().build();
//when
new CGLIBHacker().setMockitoNamingPolicy(methodProxy);
//then
Object realMethodProxy = Whitebox.invokeMethod(methodProxy, "getMethodProxy", new Object[0]);
Object createInfo = Whitebox.getInternalState(realMethodProxy, "createInfo");
NamingPolicy namingPolicy = (NamingPolicy) Whitebox.getInternalState(createInfo, "namingPolicy");
assertEquals(MockitoNamingPolicy.INSTANCE, namingPolicy);
}
项目:astor
文件:CGLIBHackerTest.java
@Test
public void shouldSetMockitoNamingPolicyEvenIfMethodProxyIsProxied() throws Exception {
//given
MockitoMethodProxy proxiedMethodProxy = spy(new MethodProxyBuilder().build());
//when
new CGLIBHacker().setMockitoNamingPolicy(proxiedMethodProxy);
//then
Object realMethodProxy = Whitebox.invokeMethod(proxiedMethodProxy, "getMethodProxy", new Object[0]);
Object createInfo = Whitebox.getInternalState(realMethodProxy, "createInfo");
NamingPolicy namingPolicy = (NamingPolicy) Whitebox.getInternalState(createInfo, "namingPolicy");
assertEquals(MockitoNamingPolicy.INSTANCE, namingPolicy);
}