org.assertj.core.api.AbstractBooleanAssert Java Examples
The following examples show how to use
org.assertj.core.api.AbstractBooleanAssert.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValueAssert.java From xmlunit with Apache License 2.0 | 6 votes |
/** * Returns an {@code Assert} object that allows performing assertions on boolean value of the {@link String} under test. * <p> * If actual value after lowercasing is one of the following "true", "false", then it can be parsed to boolean. * * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value does not contain a parsable boolean */ public AbstractBooleanAssert<?> asBoolean() { isNotNull(); boolean value = false; switch (actual.toLowerCase()) { case "true": value = true; break; case "false": value = false; break; default: throwAssertionError(shouldBeConvertible(actual, "boolean")); } return AssertionsAdapter.assertThat(value); }
Example #2
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 6 votes |
private List<AbstractBooleanAssert<?>> dependencyMatches(Class<?> originClass, Class<?> targetClass) { return ImmutableList.of( assertThat(dependency(originClass, targetClass).apply(actual)) .as("Dependency [%s -> %s] matches [%s -> %s]", actual.getOriginClass().getName(), actual.getTargetClass().getName(), originClass.getName(), targetClass.getName()), assertThat(dependency(originClass.getName(), targetClass.getName()).apply(actual)) .as("Dependency [%s -> %s] matches [%s -> %s]", actual.getOriginClass().getName(), actual.getTargetClass().getName(), originClass.getName(), targetClass.getName()), assertThat(dependency( HasName.Predicates.name(originClass.getName()), HasName.Predicates.name(targetClass.getName())).apply(actual)) .as("Dependency [%s -> %s] matches [%s -> %s]", actual.getOriginClass().getName(), actual.getTargetClass().getName(), originClass.getName(), targetClass.getName())); }
Example #3
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 5 votes |
private List<AbstractBooleanAssert<?>> dependencyMatchesOrigin(Class<?> originClass) { return ImmutableList.of( assertThat(dependencyOrigin(originClass).apply(actual)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName()), assertThat(dependencyOrigin(originClass.getName()).apply(actual)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName()), assertThat(dependencyOrigin(HasName.Predicates.name(originClass.getName())).apply(actual)) .as("Dependency origin matches '%s.class'", originClass.getSimpleName())); }
Example #4
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 5 votes |
private List<AbstractBooleanAssert<?>> dependencyMatchesTarget(Class<?> targetClass) { return ImmutableList.of( assertThat(dependencyTarget(targetClass).apply(actual)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName()), assertThat(dependencyTarget(targetClass.getName()).apply(actual)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName()), assertThat(dependencyTarget(HasName.Predicates.name(targetClass.getName())).apply(actual)) .as("Dependency target matches '%s.class'", targetClass.getSimpleName())); }
Example #5
Source File: JavaClassTest.java From ArchUnit with Apache License 2.0 | 4 votes |
public void isFalse() { for (AbstractBooleanAssert<?> assertion : assignableAssertion) { assertion.isFalse(); } }
Example #6
Source File: AssertionsAdapter.java From xmlunit with Apache License 2.0 | 4 votes |
static AbstractBooleanAssert<?> assertThat(boolean actual) { return new BooleanAssert(actual); }
Example #7
Source File: JsonPathAssert.java From spring-cloud-open-service-broker with Apache License 2.0 | 4 votes |
public AbstractBooleanAssert<?> hasBooleanAtPath(String path) { return Assertions.assertThat(actual.read(path, Boolean.class)); }
Example #8
Source File: GrantEvaluatorTest.java From strategy-spring-security-acl with Apache License 2.0 | 4 votes |
private AbstractBooleanAssert<?> assertStrong(Object domainObject) { return assertThat( permissionEvaluator.hasPermission(authentication, domainObject, "fake permission")); }
Example #9
Source File: GrantEvaluatorTest.java From strategy-spring-security-acl with Apache License 2.0 | 4 votes |
private AbstractBooleanAssert<?> assertWeak(Object domainObject) { return assertThat(permissionEvaluator.hasPermission(authentication, "fake id", domainObject.getClass().getName(), "fake permission")); }
Example #10
Source File: ReconcilePaymentsCommandTest.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 4 votes |
private AbstractBooleanAssert<?> assertReconciled(final PaySelectionId paySelectionId) { final I_C_PaySelection paySelection = paySelectionDAO.getById(paySelectionId).get(); return assertThat(paySelection.isReconciled()) .as("Is " + paySelectionId + " reconciled?"); }
Example #11
Source File: HasNameTest.java From ArchUnit with Apache License 2.0 | 4 votes |
private AbstractBooleanAssert<?> assertNameMatches(String input, String regex) { return assertThat(nameMatching(regex).apply(newHasName(input))) .as(input + " =~ " + regex); }
Example #12
Source File: ThrowsClauseTest.java From ArchUnit with Apache License 2.0 | 4 votes |
private ImmutableList<? extends AbstractBooleanAssert<?>> contains(JavaMethod method, Class<?> type) { return ImmutableList.of( assertThat(method.getThrowsClause().containsType(type)).as("throws clause contains " + type.getSimpleName()), assertThat(method.getThrowsClause().containsType(type.getName())).as("throws clause contains " + type.getSimpleName()), assertThat(method.getThrowsClause().containsType(equivalentTo(type))).as("throws clause contains " + type.getSimpleName())); }
Example #13
Source File: ThrowsClauseTest.java From ArchUnit with Apache License 2.0 | 4 votes |
private void assertAllFalse(Iterable<? extends AbstractBooleanAssert<?>> asserts) { for (AbstractBooleanAssert<?> anAssert : asserts) { anAssert.isFalse(); } }
Example #14
Source File: ThrowsClauseTest.java From ArchUnit with Apache License 2.0 | 4 votes |
private void assertAllTrue(Iterable<? extends AbstractBooleanAssert<?>> asserts) { for (AbstractBooleanAssert<?> anAssert : asserts) { anAssert.isTrue(); } }
Example #15
Source File: DescribedPredicateAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
private AbstractBooleanAssert<?> assertThatPredicateAppliesTo(T value) { return assertThat(actual.apply(value)).as("predicate <%s> matches <%s>", actual, value); }
Example #16
Source File: JavaClassTest.java From ArchUnit with Apache License 2.0 | 4 votes |
public void isTrue() { for (AbstractBooleanAssert<?> assertion : assignableAssertion) { assertion.isTrue(); } }
Example #17
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public void doesntMatchTarget(Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyTargetAssert : dependencyMatchesTarget(targetClass)) { dependencyTargetAssert.isFalse(); } }
Example #18
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public DependencyAssertion matchesTarget(Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyTargetAssert : dependencyMatchesTarget(targetClass)) { dependencyTargetAssert.isTrue(); } return this; }
Example #19
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public void doesntMatchOrigin(Class<?> originClass) { for (AbstractBooleanAssert<?> dependencyOriginAssert : dependencyMatchesOrigin(originClass)) { dependencyOriginAssert.isFalse(); } }
Example #20
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public DependencyAssertion matchesOrigin(Class<?> originClass) { for (AbstractBooleanAssert<?> dependencyOriginAssert : dependencyMatchesOrigin(originClass)) { dependencyOriginAssert.isTrue(); } return this; }
Example #21
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public DependencyAssertion doesntMatch(Class<?> originClass, Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyAssert : dependencyMatches(originClass, targetClass)) { dependencyAssert.isFalse(); } return this; }
Example #22
Source File: DependencyAssertion.java From ArchUnit with Apache License 2.0 | 4 votes |
public DependencyAssertion matches(Class<?> originClass, Class<?> targetClass) { for (AbstractBooleanAssert<?> dependencyAssert : dependencyMatches(originClass, targetClass)) { dependencyAssert.isTrue(); } return this; }
Example #23
Source File: AbstractCalculationTest.java From ehcache3 with Apache License 2.0 | 2 votes |
/** * 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); }