private AbstractBooleanAssert<?> assertValue(CheckMode mode, CharSequence value) { return assertThat(validator(mode).isValid(value, context())) .describedAs("%s(%s)" , mode.toString() , value == null ? "null" : value.toString() ); }
private List<AbstractBooleanAssert<?>> dependencyMatches(Class<?> originClass, Class<?> targetClass) { return ImmutableList.of( assertThat(dependency(originClass, targetClass).apply(input)) .as("Dependency matches '%s.class' -> '%s.class'", originClass.getSimpleName(), targetClass.getSimpleName()), assertThat(dependency(originClass.getName(), targetClass.getName()).apply(input)) .as("Dependency matches '%s.class' -> '%s.class'", originClass.getSimpleName(), targetClass.getSimpleName()), assertThat(dependency( HasName.Predicates.name(originClass.getName()), HasName.Predicates.name(targetClass.getName())).apply(input)) .as("Dependency matches '%s.class' -> '%s.class'", originClass.getSimpleName(), targetClass.getSimpleName())); }
private List<AbstractBooleanAssert<?>> dependencyMatchesOrigin(Class<?> originClass) { return ImmutableList.of( assertThat(dependencyOrigin(originClass).apply(input)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName()), assertThat(dependencyOrigin(originClass.getName()).apply(input)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName()), assertThat(dependencyOrigin(HasName.Predicates.name(originClass.getName())).apply(input)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName())); }
private List<AbstractBooleanAssert<?>> dependencyMatchesTarget(Class<?> targetClass) { return ImmutableList.of( assertThat(dependencyTarget(targetClass).apply(input)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName()), assertThat(dependencyTarget(targetClass.getName()).apply(input)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName()), assertThat(dependencyTarget(HasName.Predicates.name(targetClass.getName())).apply(input)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName())); }
private AbstractBooleanAssert<?> assertValue(CharSequence value) { return assertValue(CheckMode.ANY, value); }
private AbstractBooleanAssert<?> assertValue(CharSequence value) { return assertThat(validator().isValid(value, context())) .describedAs("%s" , value == null ? "null" : value.toString() ); }
public void isTrue() { for (AbstractBooleanAssert<?> assertion : assignableAssertion) { assertion.isTrue(); } }
public void isFalse() { for (AbstractBooleanAssert<?> assertion : assignableAssertion) { assertion.isFalse(); } }
private AbstractBooleanAssert assertMatches(String input, String regex) { return assertThat(nameMatching(regex).apply(newHasName(input))) .as(input + " =~ " + regex); }
DependencyAssertion matches(Class<?> originClass, Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyAssert : dependencyMatches(originClass, targetClass)) { dependencyAssert.isTrue(); } return this; }
DependencyAssertion doesntMatch(Class<?> originClass, Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyAssert : dependencyMatches(originClass, targetClass)) { dependencyAssert.isFalse(); } return this; }
DependencyAssertion matchesOrigin(Class<?> originClass) { for (AbstractBooleanAssert<?> dependencyOriginAssert : dependencyMatchesOrigin(originClass)) { dependencyOriginAssert.isTrue(); } return this; }
void doesntMatchOrigin(Class<?> originClass) { for (AbstractBooleanAssert<?> dependencyOriginAssert : dependencyMatchesOrigin(originClass)) { dependencyOriginAssert.isFalse(); } }
DependencyAssertion matchesTarget(Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyTargetAssert : dependencyMatchesTarget(targetClass)) { dependencyTargetAssert.isTrue(); } return this; }
void doesntMatchTarget(Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyTargetAssert : dependencyMatchesTarget(targetClass)) { dependencyTargetAssert.isFalse(); } }
public static AbstractBooleanAssert<?> resultOf(CheckedBooleanSupplier whenStep) { return assertThat(result(whenStep)); }
private AbstractBooleanAssert<?> assertWeak(Object domainObject) { return assertThat(permissionEvaluator.hasPermission(authentication, "fake id", domainObject.getClass().getName(), "fake permission")); }
private AbstractBooleanAssert<?> assertStrong(Object domainObject) { return assertThat( permissionEvaluator.hasPermission(authentication, domainObject, "fake permission")); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(Boolean)} */ default AbstractBooleanAssert<?> then(Boolean actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(Boolean)} */ default AbstractBooleanAssert<?> and(Boolean actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(boolean)} */ default AbstractBooleanAssert<?> then(boolean actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
/** * Delegate call to {@link org.assertj.core.api.Assertions#assertThat(boolean)} */ default AbstractBooleanAssert<?> and(boolean actual) { fluentBdd().verification.recordThen(this); return DELEGATE.assertThat(actual); }
public AbstractBooleanAssert<?> internal() { isNotNull(); return assertThat(actual.getGeneratedBy() == MATERIALIZER).as(description("internal")); }
public AbstractBooleanAssert<?> internal() { return assertThat(actual.iterator().next()).internal(); }
public AbstractBooleanAssert<?> conditional() { isNotNull(); return assertThat(actual.isConditional()).as(description("conditional")); }
public AbstractBooleanAssert<?> needsRedstone() { isNotNull(); return assertThat(actual.getNeedsRedstone()).as(description("needsRedstone")); }
public AbstractBooleanAssert<?> isTemplateVariable() { return Assertions.assertThat(actual.isTemplateVariable()); }
/** * Delegate call to public static org.assertj.core.api.AbstractBooleanAssert<?> org.assertj.core.api.Assertions.assertThat(boolean) * {@link org.assertj.core.api.Assertions#assertThat(boolean)} */ default AbstractBooleanAssert<?> assertThat(boolean actual) { return Assertions.assertThat(actual); }
/** * Delegate call to public static org.assertj.core.api.AbstractBooleanAssert<?> org.assertj.core.api.Assertions.assertThat(java.lang.Boolean) * {@link org.assertj.core.api.Assertions#assertThat(java.lang.Boolean)} */ default AbstractBooleanAssert<?> assertThat(Boolean actual) { return Assertions.assertThat(actual); }
/** * Extract the boolean 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 boolean */ public AbstractBooleanAssert<?> extractingJsonPathBooleanValue( CharSequence expression, Object... args) { return Assertions.assertThat( extractingJsonPathValue(expression, args, Boolean.class, "a boolean")); }
/** * 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 AbstractBooleanAssert<?> expect(boolean actual) { return assertThat(actual); }