use of org.mockito.verification.VerificationMode in project powermock by powermock.
the class MockitoNewInvocationControl method verify.
@Override
public synchronized Object verify(Object... mocks) {
final VerificationMode verificationMode;
Object mode = MockRepository.getAdditionalState("VerificationMode");
if (mode != null) {
if (mode instanceof VerificationMode) {
verificationMode = (VerificationMode) mode;
} else {
throw new IllegalStateException("Internal error. VerificationMode in MockRepository was not of type " + VerificationMode.class.getName() + ".");
}
} else {
verificationMode = times(1);
}
Mockito.verify(substitute, verificationMode);
return null;
}
use of org.mockito.verification.VerificationMode in project mule by mulesoft.
the class OperationExecutorFactoryWrapperTestCase method assertOperation.
private void assertOperation(boolean java, boolean blocking) {
from(wrapper.createExecutor(mockOperation(blocking), emptyMap()).execute(ctx)).block();
verify(executor).execute(ctx);
VerificationMode verificationMode = java && !blocking ? times(1) : never();
verify(ctx, verificationMode).setVariable(eq(COMPLETION_CALLBACK_CONTEXT_PARAM), any());
}
use of org.mockito.verification.VerificationMode in project ovirt-engine by oVirt.
the class InternalImportExternalNetworkCommandTest method verifyCalls.
private void verifyCalls(boolean attachToAllClusters) {
verify(backend).runInternalAction(eq(ActionType.AddNetwork), any(), any());
VerificationMode expectedNumberOfCalls = attachToAllClusters ? times(1) : never();
verify(backend, expectedNumberOfCalls).runInternalQuery(eq(QueryType.GetClustersByStoragePoolId), any(), any());
verify(networkHelper, expectedNumberOfCalls).createNetworkClusters(eq(Collections.singletonList(CLUSTER_ID)));
}
use of org.mockito.verification.VerificationMode in project ovirt-engine by oVirt.
the class GlusterSyncJobTest method verifyMocksForHeavyWeight.
private void verifyMocksForHeavyWeight() {
InOrder inOrder = inOrder(clusterDao, glusterUtil, volumeDao, glusterManager, brickDao);
// all clusters fetched from db
inOrder.verify(clusterDao, times(1)).getAll();
VerificationMode mode = times(1);
// get the UP server from cluster
inOrder.verify(glusterUtil, mode).getRandomUpServer(CLUSTER_ID);
// get volumes of the cluster
inOrder.verify(volumeDao, mode).getByClusterId(CLUSTER_ID);
// acquire lock on the cluster
inOrder.verify(glusterManager, mode).acquireLock(CLUSTER_ID);
// get volume advance details
inOrder.verify(glusterManager, mode).getVolumeAdvancedDetails(existingServer1, CLUSTER_ID, existingDistVol.getName());
// Update capacity info
inOrder.verify(volumeDao, mode).updateVolumeCapacityInfo(getVolumeAdvancedDetails(existingDistVol).getCapacityInfo());
// release lock on the cluster
inOrder.verify(glusterManager, mode).releaseLock(CLUSTER_ID);
// acquire lock on the cluster for repl volume
inOrder.verify(glusterManager, mode).acquireLock(CLUSTER_ID);
// get volume advance details of repl volume
inOrder.verify(glusterManager, mode).getVolumeAdvancedDetails(existingServer1, CLUSTER_ID, existingReplVol.getName());
// Add Capacity Info
inOrder.verify(volumeDao, mode).addVolumeCapacityInfo(getVolumeAdvancedDetails(existingReplVol).getCapacityInfo());
// Add Capacity Info
inOrder.verify(brickDao, mode).addBrickProperties(anyList());
// update brick status
inOrder.verify(brickDao, mode).updateBrickStatuses(argThat(hasBricksWithChangedStatus()));
// release lock on the cluster
inOrder.verify(glusterManager, mode).releaseLock(CLUSTER_ID);
}
use of org.mockito.verification.VerificationMode in project mockito by mockito.
the class VerificationWithAfterTest method should_return_formatted_output_from_toString_when_created_with_factory_method.
@Test
public void should_return_formatted_output_from_toString_when_created_with_factory_method() {
VerificationMode after = after(3);
assertThat(after).hasToString("Wanted after 3 ms: [Wanted invocations count: 1]");
}
Aggregations