org.assertj.core.api.AbstractListAssert.containsSequence()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(15.0k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.assertj.core.api.AbstractListAssert.containsSequence()方法的一些代码示例,展示了AbstractListAssert.containsSequence()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractListAssert.containsSequence()方法的具体详情如下:
包路径:org.assertj.core.api.AbstractListAssert
类名称:AbstractListAssert
方法名:containsSequence

AbstractListAssert.containsSequence介绍

暂无

代码示例

代码示例来源:origin: json-path/JsonPath

@Test
public void the_age_of_all_with_age_defined() {
  //List<Integer> result = JsonPath.read(DOCUMENT, "$.children[*].age");
  List<Integer> result = JsonPath.using(Configuration.defaultConfiguration().setOptions(Option.SUPPRESS_EXCEPTIONS)).parse(DOCUMENT).read("$.children[*].age");
  Assertions.assertThat(result).containsSequence(0, null);
}

代码示例来源:origin: spring-cloud/spring-cloud-vault

@Test
public void shouldLocatePropertySourcesForActiveProfilesInDefaultContext() {
  when(configurableEnvironment.getActiveProfiles())
      .thenReturn(new String[] { "vermillion", "periwinkle" });
  PropertySource<?> propertySource = propertySourceLocator
      .locate(configurableEnvironment);
  assertThat(propertySource).isInstanceOf(CompositePropertySource.class);
  CompositePropertySource composite = (CompositePropertySource) propertySource;
  assertThat(composite.getPropertySources()).extracting("name").containsSequence(
      "secret/application/periwinkle", "secret/application/vermillion");
}

代码示例来源:origin: sonar-perl/sonar-perl

@Test
public void heredoc() {
  assertThat(lexer.lex("print << EOL;\nbla blub\nEOL"), hasToken(PerlTokenType.STRING));
  assertThat(lexer.lex("<<EOL;\nbla blub\nEOL\n<<EOL;\nbla blu\nEOL")).hasSize(12);
  assertThat(lexer.lex("<<'EOL';\nbla blub\nEOL\n")).extracting(Token::getType)
      .containsSequence(PerlPunctuator.LTLT, PerlTokenType.STRING, PerlPunctuator.SEMICOLON, PerlTokenType.NEWLINE,
          PerlTokenType.STRING, GenericTokenType.IDENTIFIER);
  assertThat(lexer.lex("<<\"EOL\";\nbla blub\nEOL\n")).extracting(Token::getType)
      .containsSequence(PerlPunctuator.LTLT, PerlTokenType.STRING, PerlPunctuator.SEMICOLON, PerlTokenType.NEWLINE,
          PerlTokenType.STRING, GenericTokenType.IDENTIFIER);
}

代码示例来源:origin: peter-tackage/assert-rx

@Test
@Ignore("This test is intentionally failing - ignored so that the build passes")
public void testFilteringEmitsUnexpectedValue() {
  String value = "catalog";
  String value2 = "caterpillar";
  String value3 = "dog";
  Observable<String> filteredObservable = Observable.just(value, value2, value3)
      .filter(new Func1<String, Boolean>() {
        @Override
        public Boolean call(String s) {
          return s.startsWith("cat");
        }
      });
  TestSubscriber<String> ts = TestSubscriber.create();
  filteredObservable.subscribe(ts);
  assertThat(ts)
      .hasNoErrors()
      .hasReceivedValuesWhich()
      .containsSequence(value, value2, value3);
}

代码示例来源:origin: spring-cloud/spring-cloud-vault

@Test
public void shouldLocatePropertySourcesInVaultApplicationContext() {
  VaultGenericBackendProperties backendProperties = new VaultGenericBackendProperties();
  backendProperties.setApplicationName("wintermute");
  propertySourceLocator = new VaultPropertySourceLocator(operations,
      new VaultProperties(),
      VaultPropertySourceLocatorSupport.createConfiguration(backendProperties));
  when(configurableEnvironment.getActiveProfiles())
      .thenReturn(new String[] { "vermillion", "periwinkle" });
  PropertySource<?> propertySource = propertySourceLocator
      .locate(configurableEnvironment);
  assertThat(propertySource).isInstanceOf(CompositePropertySource.class);
  CompositePropertySource composite = (CompositePropertySource) propertySource;
  assertThat(composite.getPropertySources()).extracting("name").containsSequence(
      "secret/wintermute/periwinkle", "secret/wintermute/vermillion",
      "secret/wintermute");
}

代码示例来源:origin: spring-cloud/spring-cloud-vault

@Test
public void shouldCreatePropertySourcesInOrder() {
  DefaultSecretBackendConfigurer configurer = new DefaultSecretBackendConfigurer();
  configurer.add(new MySecondSecretBackendMetadata());
  configurer.add(new MyFirstSecretBackendMetadata());
  propertySourceLocator = new VaultPropertySourceLocator(operations,
      new VaultProperties(), configurer);
  PropertySource<?> propertySource = propertySourceLocator
      .locate(configurableEnvironment);
  assertThat(propertySource).isInstanceOf(CompositePropertySource.class);
  CompositePropertySource composite = (CompositePropertySource) propertySource;
  assertThat(composite.getPropertySources()).extracting("name")
      .containsSequence("foo", "bar");
}

代码示例来源:origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCancelWorkflowInstance() {
 // given
 testClient.deploy(WORKFLOW);
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 testClient.receiveElementInState("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED);
 // when
 final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey);
 // then
 assertThat(response.getIntent()).isEqualTo(WorkflowInstanceIntent.ELEMENT_TERMINATING);
 final Record<WorkflowInstanceRecordValue> workflowInstanceCanceledEvent =
   testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED);
 assertThat(workflowInstanceCanceledEvent.getKey()).isEqualTo(workflowInstanceKey);
 assertWorkflowInstanceRecord(workflowInstanceKey, workflowInstanceCanceledEvent);
 final List<Record<WorkflowInstanceRecordValue>> workflowEvents =
   testClient
     .receiveWorkflowInstances()
     .skipUntil(r -> r.getMetadata().getIntent() == WorkflowInstanceIntent.CANCEL)
     .limit(5)
     .collect(Collectors.toList());
 assertThat(workflowEvents)
   .hasSize(5)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("", WorkflowInstanceIntent.CANCEL),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED));
}

代码示例来源:origin: zeebe-io/zeebe

@Test
public void shouldCancelWorkflowInstance() {
 // given
 testClient.deploy(WORKFLOW);
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 testClient.receiveElementInState("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED);
 // when
 final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey);
 // then
 assertThat(response.getIntent()).isEqualTo(WorkflowInstanceIntent.ELEMENT_TERMINATING);
 final Record<WorkflowInstanceRecordValue> workflowInstanceCanceledEvent =
   testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED);
 assertThat(workflowInstanceCanceledEvent.getKey()).isEqualTo(workflowInstanceKey);
 assertWorkflowInstanceRecord(workflowInstanceKey, workflowInstanceCanceledEvent);
 final List<Record<WorkflowInstanceRecordValue>> workflowEvents =
   testClient
     .receiveWorkflowInstances()
     .skipUntil(r -> r.getMetadata().getIntent() == WorkflowInstanceIntent.CANCEL)
     .limit(5)
     .collect(Collectors.toList());
 assertThat(workflowEvents)
   .hasSize(5)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("", WorkflowInstanceIntent.CANCEL),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED));
}

代码示例来源:origin: zeebe-io/zeebe

@Test
public void shouldCancelWorkflowInstanceWithEmbeddedSubProcess() {
 // given
 testClient.deploy(SUB_PROCESS_WORKFLOW);
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 testClient.receiveElementInState("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED);
 // when
 cancelWorkflowInstance(workflowInstanceKey);
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowEvents =
   testClient
     .receiveWorkflowInstances()
     .skipUntil(r -> r.getMetadata().getIntent() == WorkflowInstanceIntent.CANCEL)
     .limit(7)
     .collect(Collectors.toList());
 assertThat(workflowEvents)
   .hasSize(7)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("", WorkflowInstanceIntent.CANCEL),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("subProcess", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple("subProcess", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED));
}

代码示例来源:origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCompleteScopeOnParallelGateway() {
 // given
 final BpmnModelInstance process =
   Bpmn.createExecutableProcess(PROCESS_ID)
     .startEvent("start")
     .sequenceFlowId("flow1")
     .parallelGateway("fork")
     .done();
 testClient.deploy(process);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(workflowInstanceEvents)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("fork", WorkflowInstanceIntent.ELEMENT_COMPLETED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING));
}

代码示例来源:origin: zeebe-io/zeebe

@Test
public void testBoundaryMessageEventLifecycle() {
 // given
 testClient.deploy(BOUNDARY_EVENTS_WORKFLOW);
 testClient.publishMessage("msg1", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(r -> tuple(r.getValue().getElementId(), r.getMetadata().getIntent()))
   .containsSequence(
     tuple("task", WorkflowInstanceIntent.ELEMENT_READY),
     tuple("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED),
     tuple("msg1", WorkflowInstanceIntent.EVENT_OCCURRED),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple("msg1", WorkflowInstanceIntent.EVENT_TRIGGERING),
     tuple("msg1", WorkflowInstanceIntent.EVENT_TRIGGERED));
}

代码示例来源:origin: io.zeebe/zeebe-broker-core

@Test
public void shouldCancelWorkflowInstanceWithEmbeddedSubProcess() {
 // given
 testClient.deploy(SUB_PROCESS_WORKFLOW);
 final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID);
 testClient.receiveElementInState("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED);
 // when
 cancelWorkflowInstance(workflowInstanceKey);
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowEvents =
   testClient
     .receiveWorkflowInstances()
     .skipUntil(r -> r.getMetadata().getIntent() == WorkflowInstanceIntent.CANCEL)
     .limit(7)
     .collect(Collectors.toList());
 assertThat(workflowEvents)
   .hasSize(7)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("", WorkflowInstanceIntent.CANCEL),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("subProcess", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple("subProcess", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED));
}

代码示例来源:origin: zeebe-io/zeebe

@Test
public void shouldCompleteScopeOnParallelGateway() {
 // given
 final BpmnModelInstance process =
   Bpmn.createExecutableProcess(PROCESS_ID)
     .startEvent("start")
     .sequenceFlowId("flow1")
     .parallelGateway("fork")
     .done();
 testClient.deploy(process);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final Record<WorkflowInstanceRecordValue> completedEvent =
   testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETED);
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .limit(r -> r.getPosition() == completedEvent.getPosition())
     .collect(Collectors.toList());
 assertThat(workflowInstanceEvents)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("fork", WorkflowInstanceIntent.GATEWAY_ACTIVATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING));
}

代码示例来源:origin: io.zeebe/zeebe-broker-core

@Test
public void testBoundaryMessageEventLifecycle() {
 // given
 testClient.deploy(BOUNDARY_EVENTS_WORKFLOW);
 testClient.publishMessage("msg1", "order-123");
 testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123"));
 final List<Record<WorkflowInstanceRecordValue>> events =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(events)
   .extracting(r -> tuple(r.getValue().getElementId(), r.getMetadata().getIntent()))
   .containsSequence(
     tuple("task", WorkflowInstanceIntent.ELEMENT_ACTIVATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_ACTIVATED),
     tuple("task", WorkflowInstanceIntent.EVENT_OCCURRED),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATING),
     tuple("task", WorkflowInstanceIntent.ELEMENT_TERMINATED),
     tuple("msg1", WorkflowInstanceIntent.ELEMENT_ACTIVATING),
     tuple("msg1", WorkflowInstanceIntent.ELEMENT_ACTIVATED),
     tuple("msg1", WorkflowInstanceIntent.ELEMENT_COMPLETING),
     tuple("msg1", WorkflowInstanceIntent.ELEMENT_COMPLETED));
}

代码示例来源:origin: zeebe-io/zeebe

@Test
public void shouldPassThroughParallelGateway() {
 // given
 final BpmnModelInstance process =
   Bpmn.createExecutableProcess(PROCESS_ID)
     .startEvent("start")
     .sequenceFlowId("flow1")
     .parallelGateway("fork")
     .sequenceFlowId("flow2")
     .endEvent("end")
     .done();
 testClient.deploy(process);
 // when
 testClient.createWorkflowInstance(PROCESS_ID);
 // then
 final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents =
   testClient
     .receiveWorkflowInstances()
     .limitToWorkflowInstanceCompleted()
     .collect(Collectors.toList());
 assertThat(workflowInstanceEvents)
   .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent())
   .containsSequence(
     tuple("fork", WorkflowInstanceIntent.GATEWAY_ACTIVATED),
     tuple("flow2", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN),
     tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATING),
     tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATED),
     tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING));
}

代码示例来源:origin: io.zeebe/zeebe-broker-core

.containsSequence(
  tuple("fork", WorkflowInstanceIntent.ELEMENT_ACTIVATING),
  tuple("fork", WorkflowInstanceIntent.ELEMENT_ACTIVATED),

相关文章

微信公众号

最新文章

更多