Java 类org.mockito.internal.progress.MockingProgress 实例源码
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:MockitoAopProxyTargetInterceptor.java
Verification(Object target) {
MockUtil mockUtil = new MockUtil();
InternalMockHandler<?> handler = mockUtil.getMockHandler(target);
InvocationContainer container = handler.getInvocationContainer();
Field field = ReflectionUtils.findField(container.getClass(),
"mockingProgress");
ReflectionUtils.makeAccessible(field);
this.progress = (MockingProgress) ReflectionUtils.getField(field, container);
}
项目:spring-boot-concourse
文件:MockitoAopProxyTargetInterceptor.java
Verification(Object target) {
MockUtil mockUtil = new MockUtil();
InternalMockHandler<?> handler = mockUtil.getMockHandler(target);
InvocationContainer container = handler.getInvocationContainer();
Field field = ReflectionUtils.findField(container.getClass(),
"mockingProgress");
ReflectionUtils.makeAccessible(field);
this.progress = (MockingProgress) ReflectionUtils.getField(field, container);
}
项目:powermock
文件:MockitoMethodInvocationControl.java
private VerificationMode getVerificationMode() {
try {
MockingProgress progress = (MockingProgress) Whitebox.invokeMethod(ThreadSafeMockingProgress.class,
"threadSafely");
return getVerificationModeFromMockProgress(progress);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
项目:powermock
文件:MockitoMethodInvocationControl.java
@SuppressWarnings("unchecked")
private VerificationMode getVerificationModeFromMockProgress(MockingProgress mockingProgress) {
if (mockingProgress == null) {
return null;
}
if (mockingProgress instanceof ThreadSafeMockingProgress) {
ThreadLocal<MockingProgress> threadLocal = Whitebox.getInternalState(mockingProgress, ThreadLocal.class);
return getVerificationModeFromMockProgress(threadLocal.get());
} else {
Localized<VerificationMode> verificationMode = Whitebox.getInternalState(mockingProgress, Localized.class);
return verificationMode == null ? null : verificationMode.getObject();
}
}
项目:empiria.player
文件:MocksCollector.java
public MocksCollector() {
createdMocks = new LinkedList<Object>();
final MockingProgress progress = new ThreadSafeMockingProgress();
progress.setListener(new CollectCreatedMocks(createdMocks));
}
项目:powermock
文件:PowerMockitoCore.java
private MockingProgress getMockingProgress() {
return Whitebox.getInternalState(Mockito.class, MockingProgress.class);
}
项目:spring-batch
文件:MocksCollector.java
public MocksCollector() {
createdMocks = new LinkedList<>();
final MockingProgress progress = new ThreadSafeMockingProgress();
progress.setListener(new CollectCreatedMocks(createdMocks));
}
项目:astor
文件:InvocationContainerImpl.java
public InvocationContainerImpl(MockingProgress mockingProgress) {
this.mockingProgress = mockingProgress;
}
项目:astor
文件:WarningsCollector.java
public WarningsCollector() {
createdMocks = new LinkedList();
MockingProgress progress = new ThreadSafeMockingProgress();
progress.setListener(new CollectCreatedMocks(createdMocks));
}
项目:astor
文件:InvocationContainerImpl.java
public InvocationContainerImpl(MockingProgress mockingProgress, MockCreationSettings mockSettings) {
this.mockingProgress = mockingProgress;
this.registeredInvocations = createRegisteredInvocations(mockSettings);
}
项目:astor
文件:WarningsCollector.java
public WarningsCollector() {
createdMocks = new LinkedList();
MockingProgress progress = new ThreadSafeMockingProgress();
progress.setListener(new CollectCreatedMocks(createdMocks));
}
项目:powermock
文件:PowerMockito.java
/**
* Verify a private method invocation with a given verification mode.
*
* @see {@link Mockito#verify(Object)}
* @throws Exception
* If something unexpected goes wrong.
*/
public static PrivateMethodVerification verifyPrivate(Object object, VerificationMode verificationMode)
throws Exception {
Whitebox.getInternalState(Mockito.class, MockingProgress.class).verificationStarted(
POWERMOCKITO_CORE.wrapInMockitoSpecificVerificationMode(object, verificationMode));
return new DefaultPrivateMethodVerification(object);
}
项目:powermock
文件:PowerMockito.java
/**
* Verifies certain behavior happened at least once / exact number of times
* / never. E.g:
*
* <pre>
* verifyStatic(times(5));
* ClassWithStaticMethod.someStaticMethod("was called five times");
*
* verifyStatic(atLeast(2));
* ClassWithStaticMethod.someStaticMethod("was called at least two times");
*
* //you can use flexible argument matchers, e.g:
* verifyStatic(atLeastOnce());
* ClassWithStaticMethod.someMethod(<b>anyString()</b>);
* </pre>
*
* <b>times(1) is the default</b> and can be omitted
* <p>
*
* @param verificationMode
* times(x), atLeastOnce() or never()
*/
public static synchronized void verifyStatic(VerificationMode verificationMode) {
Whitebox.getInternalState(Mockito.class, MockingProgress.class).verificationStarted(
POWERMOCKITO_CORE.wrapInStaticVerificationMode(verificationMode));
}