public static <$ActualResult> AbstractObjectAssert<?, $ActualResult> resultOf( CheckedSupplier<$ActualResult> whenStep) { return assertThat(result(whenStep)); }
@SuppressWarnings("unchecked") private <T> AbstractObjectAssert<?, T> assertAt(int index, Class<T> type) { AbstractObjectAssert<?, ?> anAssert = Assertions.assertThat(events.get(index)); anAssert.isInstanceOf(type); return (AbstractObjectAssert<?, T>) anAssert; }
public <T> AbstractObjectAssert<?, T> assertFirst(Class<T> type) { return this.assertAt(0, type); }
public <T> AbstractObjectAssert<?, T> assertLast(Class<T> type) { return this.assertAt(events.size() - 1, type); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(T)} */ default <T> AbstractObjectAssert<?, T> then(T actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(T)} */ default <T> AbstractObjectAssert<?, T> and(T actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
private AbstractObjectAssert<?, CommandPartBuffer> minecraftCommand() { isNotNull(); return assertThat(actual.getMinecraftCommand()).as(description("minecraftCommand")); }
private AbstractObjectAssert<?, Number> assertStat(String key) { return assertThat((Number) cacheStatistics.getKnownStatistics().get(key).value()); }
private AbstractObjectAssert<?, Number> assertStat(String key) { return assertThat((Number) onHeap.getKnownStatistics().get(key).value()); }
public AbstractObjectAssert<?, Method> method() { return Assertions.assertThat(actual.getMethod()).as(navigationDescription("method")); }
/** * Delegate call to public static <T> org.assertj.core.api.AbstractObjectAssert<?, T> org.assertj.core.api.Assertions.assertThat(T) * {@link org.assertj.core.api.Assertions#assertThat(java.lang.Object)} */ default <T> AbstractObjectAssert<?, T> assertThat(T assertion) { return Assertions.assertThat(assertion); }
/** * Extract the value at the given JSON path for further object assertions. * @param expression the {@link JsonPath} expression * @param args arguments to parameterize the {@code JsonPath} expression with, using * formatting specifiers defined in {@link String#format(String, Object...)} * @return a new assertion object whose object under test is the extracted item * @throws AssertionError if the path is not valid */ public AbstractObjectAssert<?, Object> extractingJsonPathValue( CharSequence expression, Object... args) { return Assertions.assertThat(new JsonPathValue(expression, args).getValue(false)); }
/** * Extract the number value at the given JSON path for further object assertions. * @param expression the {@link JsonPath} expression * @param args arguments to parameterize the {@code JsonPath} expression with, using * formatting specifiers defined in {@link String#format(String, Object...)} * @return a new assertion object whose object under test is the extracted item * @throws AssertionError if the path is not valid or does not result in a number */ public AbstractObjectAssert<?, Number> extractingJsonPathNumberValue( CharSequence expression, Object... args) { return Assertions.assertThat( extractingJsonPathValue(expression, args, Number.class, "a number")); }
/** * A little wrapper over {@code assertThat} that just mention that this what we expect from the test. So if the * expectation fails, it's probably the test that is wrong, not the implementation. * * @param actual actual value * @return an AssertJ assertion */ protected static <T> AbstractObjectAssert<?, T> expect(T actual) { return assertThat(actual); }
/** * Chain assertion on the content of the {@link Optional}. * <p> * Example : * * <pre><code class='java'> Optional<Number> optional = Optional.of(12L); * * assertThat(optional).extractingValue().isInstanceOf(Long.class);</code></pre> * * @return a new {@link AbstractObjectAssert} for assertions chaining on the content of the Optional. * @throws AssertionError if the actual {@link Optional} is {@code null}. * @throws AssertionError if the actual {@link Optional} contains a null instance. */ public AbstractObjectAssert<?, T> extractingValue() { isPresent(); return assertThat(actual.get()); }