/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
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);
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);
@SafeVarargs @SuppressWarnings("varargs") public static Condition<ExecutionEvent> event(Condition<? super ExecutionEvent>... conditions) { return Assertions.<ExecutionEvent> allOf(conditions); }
@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(); }
public static Condition<ExecutionEvent> finished(Condition<TestExecutionResult> resultCondition) { return allOf(type(FINISHED), result(resultCondition)); }
public static Condition<ExecutionEvent> container(String uniqueIdSubstring) { return allOf(container(), uniqueIdSubstring(uniqueIdSubstring)); }
public static Condition<ExecutionEvent> dynamicTestRegistered(String uniqueIdSubstring) { return allOf(type(DYNAMIC_TEST_REGISTERED), uniqueIdSubstring(uniqueIdSubstring)); }
public static Condition<ExecutionEvent> skippedWithReason(String expectedReason) { return allOf(type(SKIPPED), reason(expectedReason)); }
public static Condition<ExecutionEvent> test(String uniqueIdSubstring) { return allOf(test(), uniqueIdSubstring(uniqueIdSubstring)); }
private static Condition<ExecutionEvent> finishedWithCause(Status expectedStatus, Condition<? super Throwable> causeCondition) { return finished(allOf(status(expectedStatus), cause(causeCondition))); }
public static Condition<ExecutionEvent> test(String uniqueIdSubstring, String displayName) { return allOf(test(), uniqueIdSubstring(uniqueIdSubstring), displayName(displayName)); }
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); } }