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

x33g5p2x  于2022-01-20 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(88)

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

IterableAssert.anySatisfy介绍

暂无

代码示例

代码示例来源:origin: io.micrometer/micrometer-test

@Test
@DisplayName("function timers respect the base unit of an underlying registry")
void functionTimerUnits(MeterRegistry registry) {
  Object o = new Object();
  registry.more().timer("function.timer", emptyList(),
    o, o2 -> 1, o2 -> 1, TimeUnit.MILLISECONDS);
  FunctionTimer ft = registry.get("function.timer").functionTimer();
  clock(registry).add(step());
  assertThat(ft.measure())
    .anySatisfy(ms -> {
      TimeUnit baseUnit = TimeUnit.valueOf(requireNonNull(ft.getId().getBaseUnit()).toUpperCase());
      assertThat(ms.getStatistic()).isEqualTo(Statistic.TOTAL_TIME);
      assertThat(TimeUtils.convert(ms.getValue(), baseUnit, TimeUnit.MILLISECONDS)).isEqualTo(1);
    });
}

代码示例来源:origin: kiegroup/appformer

@Test
public void testMerge() {
  String oldFieldName = "oldField";
  String newFieldName = "newField";
  Message oldMessage = new Message();
  Field oldField = new Field(ProtobufScope.OPTIONAL,
                ProtobufType.STRING,
                oldFieldName,
                1);
  oldMessage.setFields(Collections.singleton(oldField));
  Message newMessage = new Message();
  Field newField = new Field(ProtobufScope.OPTIONAL,
                ProtobufType.STRING,
                newFieldName,
                2);
  newMessage.setFields(new HashSet<>(Arrays.asList(oldField,
                           newField)));
  Message mergedMessage = this.infinispanSchemaStore.merge(oldMessage,
                               newMessage);
  assertThat(mergedMessage.getFields().size()).isEqualTo(2);
  assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(oldFieldName));
  assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(newFieldName));
}

代码示例来源:origin: io.syndesis.connector/connector-webhook

@Test
public void shouldAddWrapperProcessorIfSyndesisJsonSchemaGiven() throws Exception {
  final WebhookConnectorCustomizer customizer = new WebhookConnectorCustomizer();
  customizer.setCamelContext(mock(CamelContext.class));
  customizer.setOutputDataShape(new DataShape.Builder().kind(DataShapeKinds.JSON_SCHEMA).specification(SIMPLE_SCHEMA).build());
  customizer.customize(component, Collections.emptyMap());
  final Processor beforeConsumer = component.getBeforeConsumer();
  assertThat(beforeConsumer).isInstanceOf(Pipeline.class);
  final Pipeline pipeline = (Pipeline) beforeConsumer;
  final Collection<Processor> processors = pipeline.getProcessors();
  assertThat(processors).hasSize(2).anySatisfy(p -> assertThat(p).isInstanceOf(HttpRequestWrapperProcessor.class));
  final HttpRequestWrapperProcessor wrapper = (HttpRequestWrapperProcessor) processors.stream().filter(p -> p instanceof HttpRequestWrapperProcessor)
    .findFirst().get();
  assertThat(wrapper.getParameters()).containsOnly("source", "status");
  final Processor removeHeader = processors.stream().filter(p -> !(p instanceof HttpRequestWrapperProcessor)).findFirst().get();
  final Exchange exchange = mock(Exchange.class);
  final Message in = mock(Message.class);
  when(exchange.getIn()).thenReturn(in);
  removeHeader.process(exchange);
  verify(in).removeHeader(Exchange.HTTP_URI);
}

代码示例来源:origin: org.uberfire/uberfire-metadata-backend-infinispan

@Test
public void testMerge() {
  String oldFieldName = "oldField";
  String newFieldName = "newField";
  Message oldMessage = new Message();
  Field oldField = new Field(ProtobufScope.OPTIONAL,
                ProtobufType.STRING,
                oldFieldName,
                1);
  oldMessage.setFields(Collections.singleton(oldField));
  Message newMessage = new Message();
  Field newField = new Field(ProtobufScope.OPTIONAL,
                ProtobufType.STRING,
                newFieldName,
                2);
  newMessage.setFields(new HashSet<>(Arrays.asList(oldField,
                           newField)));
  Message mergedMessage = this.infinispanSchemaStore.merge(oldMessage,
                               newMessage);
  assertThat(mergedMessage.getFields().size()).isEqualTo(2);
  assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(oldFieldName));
  assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(newFieldName));
}

相关文章

微信公众号

最新文章

更多