Search in sources :

Example 1 with MockingProgress

use of org.mockito.internal.progress.MockingProgress in project mockito by mockito.

the class MockedStaticImpl method reset.

@Override
public void reset() {
    assertNotClosed();
    MockingProgress mockingProgress = mockingProgress();
    mockingProgress.validateState();
    mockingProgress.reset();
    mockingProgress.resetOngoingStubbing();
    resetMock(control.getType());
}
Also used : MockingProgress(org.mockito.internal.progress.MockingProgress)

Example 2 with MockingProgress

use of org.mockito.internal.progress.MockingProgress in project mockito by mockito.

the class MockedStaticImpl method when.

@Override
public <S> OngoingStubbing<S> when(Verification verification) {
    assertNotClosed();
    try {
        verification.apply();
    } catch (MockitoException exception) {
        throw exception;
    } catch (Throwable ignored) {
    }
    MockingProgress mockingProgress = mockingProgress();
    mockingProgress.stubbingStarted();
    @SuppressWarnings("unchecked") OngoingStubbing<S> stubbing = (OngoingStubbing<S>) mockingProgress.pullOngoingStubbing();
    if (stubbing == null) {
        mockingProgress.reset();
        throw missingMethodInvocation();
    }
    return stubbing;
}
Also used : MockitoException(org.mockito.exceptions.base.MockitoException) OngoingStubbing(org.mockito.stubbing.OngoingStubbing) MockingProgress(org.mockito.internal.progress.MockingProgress)

Example 3 with MockingProgress

use of org.mockito.internal.progress.MockingProgress in project mockito by mockito.

the class MockitoCore method stubber.

public Stubber stubber() {
    MockingProgress mockingProgress = mockingProgress();
    mockingProgress.stubbingStarted();
    mockingProgress.resetOngoingStubbing();
    return new StubberImpl();
}
Also used : MockingProgress(org.mockito.internal.progress.MockingProgress) StubberImpl(org.mockito.internal.stubbing.StubberImpl)

Example 4 with MockingProgress

use of org.mockito.internal.progress.MockingProgress in project mockito by mockito.

the class MockitoCore method reset.

public <T> void reset(T... mocks) {
    MockingProgress mockingProgress = mockingProgress();
    mockingProgress.validateState();
    mockingProgress.reset();
    mockingProgress.resetOngoingStubbing();
    for (T m : mocks) {
        resetMock(m);
    }
}
Also used : MockingProgress(org.mockito.internal.progress.MockingProgress)

Example 5 with MockingProgress

use of org.mockito.internal.progress.MockingProgress in project mockito by mockito.

the class MockitoCore method stubber.

public Stubber stubber(Strictness strictness) {
    MockingProgress mockingProgress = mockingProgress();
    mockingProgress.stubbingStarted();
    mockingProgress.resetOngoingStubbing();
    return new StubberImpl(strictness);
}
Also used : MockingProgress(org.mockito.internal.progress.MockingProgress) StubberImpl(org.mockito.internal.stubbing.StubberImpl)

Aggregations

MockingProgress (org.mockito.internal.progress.MockingProgress)10 MockingDetails (org.mockito.MockingDetails)2 MockitoException (org.mockito.exceptions.base.MockitoException)2 StubberImpl (org.mockito.internal.stubbing.StubberImpl)2 MockAwareVerificationMode (org.mockito.internal.verification.MockAwareVerificationMode)2 MockHandler (org.mockito.invocation.MockHandler)2 OngoingStubbing (org.mockito.stubbing.OngoingStubbing)2 VerificationMode (org.mockito.verification.VerificationMode)2 MockitoAssertionError (org.mockito.exceptions.base.MockitoAssertionError)1 DefaultMockingDetails (org.mockito.internal.util.DefaultMockingDetails)1 MockUtil.getMockHandler (org.mockito.internal.util.MockUtil.getMockHandler)1