本文整理了Java中org.mockito.Mockito.anyCollectionOf()
方法的一些代码示例,展示了Mockito.anyCollectionOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mockito.anyCollectionOf()
方法的具体详情如下:
包路径:org.mockito.Mockito
类名称:Mockito
方法名:anyCollectionOf
暂无
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testVariableModificationForNonExistingProcessInstance() {
doThrow(new ProcessEngineException("expected exception")).when(runtimeServiceMock).updateVariables(anyString(), anyMapOf(String.class, Object.class), anyCollectionOf(String.class));
String variableKey = "aKey";
int variableValue = 123;
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
messageBodyJson.put("modifications", modifications);
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).contentType(ContentType.JSON).body(messageBodyJson)
.then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON)
.body("type", equalTo(RestException.class.getSimpleName()))
.body("message", equalTo("Cannot modify variables for process instance " + MockProvider.EXAMPLE_PROCESS_INSTANCE_ID + ": expected exception"))
.when().post(PROCESS_INSTANCE_VARIABLES_URL);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testVariableModificationThrowsAuthorizationException() {
String variableKey = "aKey";
int variableValue = 123;
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
messageBodyJson.put("modifications", modifications);
String message = "excpected exception";
doThrow(new AuthorizationException(message)).when(runtimeServiceMock).updateVariables(anyString(), anyMapOf(String.class, Object.class), anyCollectionOf(String.class));
given()
.pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
.contentType(ContentType.JSON)
.body(messageBodyJson)
.then().expect()
.statusCode(Status.FORBIDDEN.getStatusCode())
.body("type", is(AuthorizationException.class.getSimpleName()))
.body("message", is(message))
.when()
.post(PROCESS_INSTANCE_VARIABLES_URL);
}
代码示例来源:origin: sonia.scm/scm-test
when(subject.isPermitted(any(Permission.class))).thenReturn(Boolean.TRUE);
when(subject.isPermitted(any(String.class))).thenReturn(Boolean.TRUE);
when(subject.isPermittedAll(anyCollectionOf(Permission.class))).thenReturn(
Boolean.TRUE);
when(subject.isPermittedAll()).thenReturn(Boolean.TRUE);
代码示例来源:origin: org.guvnor/guvnor-ala-ui-client
@Test
public void testOnRefreshProviderTypesWithNOEnabledProviderTypes() {
providerTypes.clear();
when(providerTypeService.getEnabledProviderTypes()).thenReturn(providerTypes);
presenter.onRefreshProviderTypes(new ProviderTypeListRefreshEvent());
verify(view,
times(1)).setEmptyView(providerTypeEmptyPresenterView);
verify(providerTypeNavigationPresenter,
times(1)).clear();
verify(providerTypeNavigationPresenter,
times(0)).setup(any(ProviderType.class),
anyCollectionOf(ProviderType.class));
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-ala-ui-client
@Test
public void testOnRefreshProviderTypesWithNOEnabledProviderTypes() {
providerTypes.clear();
when(providerTypeService.getEnabledProviderTypes()).thenReturn(providerTypes);
presenter.onRefreshProviderTypes(new ProviderTypeListRefreshEvent());
verify(view,
times(1)).setEmptyView(providerTypeEmptyPresenterView);
verify(providerTypeNavigationPresenter,
times(1)).clear();
verify(providerTypeNavigationPresenter,
times(0)).setup(any(ProviderType.class),
anyCollectionOf(ProviderType.class));
}
代码示例来源:origin: java-json-tools/json-schema-core
@Test
public void checkingWillNotDiveIntoUnknownKeywords()
throws ProcessingException
{
final ObjectNode node = FACTORY.objectNode();
node.put(K1, K1);
final ObjectNode schema = FACTORY.objectNode();
schema.put("foo", node);
final SchemaTree tree
= new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
final ValueHolder<SchemaTree> holder = ValueHolder.hold("schema", tree);
processor.process(report, holder);
verify(checker, never()).checkSyntax(anyCollectionOf(JsonPointer.class),
any(MessageBundle.class), anyReport(), anySchema());
}
代码示例来源:origin: org.guvnor/guvnor-ala-ui-client
@Test
public void testOnProviderTypeSelectedWithNOProviders() {
//pick an arbitrary element as the selected
ProviderType selectedProviderType = providerTypes.iterator().next();
ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey();
//the selected provider type don't have providers.
List<ProviderKey> providerKeys = new ArrayList<>();
ProvidersInfo providersInfo = mock(ProvidersInfo.class);
when(providersInfo.getProviderType()).thenReturn(selectedProviderType);
when(providersInfo.getProvidersKey()).thenReturn(providerKeys);
when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType);
when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo);
presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey()));
verify(providerEmptyPresenter,
times(1)).setProviderType(selectedProviderType);
verify(view,
times(1)).setContent(providerEmptyPresenterView);
verify(providerTypePresenter,
times(1)).setup(any(ProviderType.class),
anyCollectionOf(ProviderKey.class),
any(ProviderKey.class));
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-ala-ui-client
@Test
public void testOnProviderTypeSelectedWithNOProviders() {
//pick an arbitrary element as the selected
ProviderType selectedProviderType = providerTypes.iterator().next();
ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey();
//the selected provider type don't have providers.
List<ProviderKey> providerKeys = new ArrayList<>();
ProvidersInfo providersInfo = mock(ProvidersInfo.class);
when(providersInfo.getProviderType()).thenReturn(selectedProviderType);
when(providersInfo.getProvidersKey()).thenReturn(providerKeys);
when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType);
when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo);
presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey()));
verify(providerEmptyPresenter,
times(1)).setProviderType(selectedProviderType);
verify(view,
times(1)).setContent(providerEmptyPresenterView);
verify(providerTypePresenter,
times(1)).setup(any(ProviderType.class),
anyCollectionOf(ProviderKey.class),
any(ProviderKey.class));
}
内容来源于网络,如有侵权,请联系作者删除!