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

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

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

Assertions.allOf介绍

[英]Creates a new AllOf
[中]创建新的AllOf

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new <code>{@link AllOf}</code>
 *
 * @param <T> the type of object the given condition accept.
 * @param conditions the conditions to evaluate.
 * @return the created {@code AnyOf}.
 * @throws NullPointerException if the given iterable is {@code null}.
 * @throws NullPointerException if any of the elements in the given iterable is {@code null}.
 */
default <T> Condition<T> allOf(final Iterable<? extends Condition<? super T>> conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new <code>{@link AllOf}</code>
 *
 * @param <T> the type of object the given condition accept.
 * @param conditions the conditions to evaluate.
 * @return the created {@code AnyOf}.
 * @throws NullPointerException if the given array is {@code null}.
 * @throws NullPointerException if any of the elements in the given array is {@code null}.
 */
default <T> Condition<T> allOf(@SuppressWarnings("unchecked") final Condition<? super T>... conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new <code>{@link AllOf}</code>
 *
 * @param <T> the type of object the given condition accept.
 * @param conditions the conditions to evaluate.
 * @return the created {@code AnyOf}.
 * @throws NullPointerException if the given iterable is {@code null}.
 * @throws NullPointerException if any of the elements in the given iterable is {@code null}.
 */
default <T> Condition<T> allOf(final Iterable<? extends Condition<? super T>> conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new <code>{@link AllOf}</code>
 *
 * @param <T> the type of object the given condition accept.
 * @param conditions the conditions to evaluate.
 * @return the created {@code AnyOf}.
 * @throws NullPointerException if the given array is {@code null}.
 * @throws NullPointerException if any of the elements in the given array is {@code null}.
 */
default <T> Condition<T> allOf(@SuppressWarnings("unchecked") final Condition<? super T>... conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Delegate call to {@link org.assertj.core.api.Assertions#allOf(Iterable<? extends Condition>)}
 */
default public <T> Condition<T> allOf(final Iterable<? extends Condition<? super T>> conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Delegate call to {@link org.assertj.core.api.Assertions#allOf(Condition[])}
 */
default public <T> Condition<T> allOf(@SuppressWarnings("unchecked") final Condition<? super T>... conditions) {
 return Assertions.allOf(conditions);
}

代码示例来源:origin: spring-projects/spring-kafka

Iterator<ConsumerRecord<String, String>> iterator = records.iterator();
ConsumerRecord<String, String> record = iterator.next();
assertThat(record).has(Assertions.<ConsumerRecord<String, String>>allOf(key("foo"), value("bar")));
if (!iterator.hasNext()) {
  records = KafkaTestUtils.getRecords(consumer);
assertThat(record).has(Assertions.<ConsumerRecord<String, String>>allOf(key("baz"), value("qux")));
consumer.close();
assertThat(KafkaTestUtils.getPropertyValue(pf, "cache", BlockingQueue.class).size()).isEqualTo(1);

代码示例来源:origin: spring-projects/spring-kafka

Iterator<ConsumerRecord<String, String>> iterator = records.iterator();
ConsumerRecord<String, String> record = iterator.next();
assertThat(record).has(Assertions.<ConsumerRecord<String, String>>allOf(key("foo"), value("bar")));
if (!iterator.hasNext()) {
  records = KafkaTestUtils.getRecords(consumer);
assertThat(record).has(Assertions.<ConsumerRecord<String, String>>allOf(key("baz"), value("qux")));
consumer.close();
assertThat(KafkaTestUtils.getPropertyValue(pf, "cache", BlockingQueue.class).size()).isEqualTo(1);

代码示例来源:origin: junit-pioneer/junit-pioneer

@SafeVarargs
@SuppressWarnings("varargs")
public static Condition<ExecutionEvent> event(Condition<? super ExecutionEvent>... conditions) {
  return Assertions.<ExecutionEvent> allOf(conditions);
}

代码示例来源:origin: spring-projects/spring-kafka

@Test
public void testTemplateDisambiguation() throws Exception {
  Map<String, Object> senderProps = KafkaTestUtils.producerProps(embeddedKafka);
  DefaultKafkaProducerFactory<String, String> pf = new DefaultKafkaProducerFactory<>(senderProps);
  pf.setKeySerializer(new StringSerializer());
  KafkaTemplate<String, String> template = new KafkaTemplate<>(pf, true);
  template.setDefaultTopic(STRING_KEY_TOPIC);
  Map<String, Object> consumerProps = KafkaTestUtils.consumerProps("testTString", "false", embeddedKafka);
  consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
  DefaultKafkaConsumerFactory<String, String> cf = new DefaultKafkaConsumerFactory<>(consumerProps);
  cf.setKeyDeserializer(new StringDeserializer());
  Consumer<String, String> consumer = cf.createConsumer();
  embeddedKafka.consumeFromAnEmbeddedTopic(consumer, STRING_KEY_TOPIC);
  template.sendDefault("foo", "bar");
  template.flush();
  ConsumerRecord<String, String> record = KafkaTestUtils.getSingleRecord(consumer, STRING_KEY_TOPIC);
  assertThat(record).has(Assertions.<ConsumerRecord<String, String>>allOf(key("foo"), value("bar")));
  consumer.close();
  pf.createProducer().close();
  pf.destroy();
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> finished(Condition<TestExecutionResult> resultCondition) {
  return allOf(type(FINISHED), result(resultCondition));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> container(String uniqueIdSubstring) {
  return allOf(container(), uniqueIdSubstring(uniqueIdSubstring));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> dynamicTestRegistered(String uniqueIdSubstring) {
  return allOf(type(DYNAMIC_TEST_REGISTERED), uniqueIdSubstring(uniqueIdSubstring));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> skippedWithReason(String expectedReason) {
  return allOf(type(SKIPPED), reason(expectedReason));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> test(String uniqueIdSubstring) {
  return allOf(test(), uniqueIdSubstring(uniqueIdSubstring));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

private static Condition<ExecutionEvent> finishedWithCause(Status expectedStatus,
    Condition<? super Throwable> causeCondition) {
  return finished(allOf(status(expectedStatus), cause(causeCondition)));
}

代码示例来源:origin: junit-pioneer/junit-pioneer

public static Condition<ExecutionEvent> test(String uniqueIdSubstring, String displayName) {
  return allOf(test(), uniqueIdSubstring(uniqueIdSubstring), displayName(displayName));
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

private static Condition<DataSource> mockWithName(Object object, String name) {
    MockUtil mockUtil = new MockUtil();

    Condition<Object> isMock = new Condition<>(
        dataSource -> mockUtil.isMock(object),
        "target object is not a mock");
    Condition<Object> hasName = new Condition<>(
        dataSource -> name.equals(mockUtil.getMockName(object).toString()),
        "mock has an unexpected name");

    return allOf(isMock, hasName);
  }
}

相关文章