Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldBeAnArray.shouldBeAnArray;
Expand Down Expand Up @@ -136,6 +137,24 @@ private static <E> Optional<UnsatisfiedRequirement> failsRequirements(Consumer<?
return Optional.empty();
}

@Override
public SELF anyMatch(Predicate<? super ELEMENT> predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

@Override
public SELF anyMatch(Predicate<? super ELEMENT> predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(Predicate<? super ELEMENT> predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate::test)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

@Override
protected void assertContains(ELEMENT[] values) {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(BooleanProcedu
return Optional.empty();
}

public BooleanIterableAssert anyMatch(BooleanPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public BooleanIterableAssert anyMatch(BooleanPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(BooleanPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public BooleanIterableAssert contains(boolean... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -86,6 +87,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(ByteProcedure
return Optional.empty();
}

public ByteIterableAssert anyMatch(BytePredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public ByteIterableAssert anyMatch(BytePredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(BytePredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public ByteIterableAssert contains(byte... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(CharProcedure
return Optional.empty();
}

public CharIterableAssert anyMatch(CharPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public CharIterableAssert anyMatch(CharPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(CharPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public CharIterableAssert contains(char... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(DoubleConsumer
return Optional.empty();
}

public DoubleIterableAssert anyMatch(DoublePredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public DoubleIterableAssert anyMatch(DoublePredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(DoublePredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate::test)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public DoubleIterableAssert contains(double... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(FloatProcedure
return Optional.empty();
}

public FloatIterableAssert anyMatch(FloatPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public FloatIterableAssert anyMatch(FloatPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(FloatPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public FloatIterableAssert contains(float... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand All @@ -30,6 +31,7 @@
import org.assertj.core.presentation.PredicateDescription;
import org.eclipse.collections.api.IntIterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.block.predicate.primitive.BooleanPredicate;
import org.eclipse.collections.api.factory.primitive.IntLists;
import org.eclipse.collections.api.list.primitive.ImmutableIntList;
import org.eclipse.collections.api.list.primitive.IntList;
Expand Down Expand Up @@ -85,6 +87,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(IntConsumer re
return Optional.empty();
}

public IntIterableAssert anyMatch(IntPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public IntIterableAssert anyMatch(IntPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(IntPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate::test)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public IntIterableAssert contains(int... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(LongConsumer r
return Optional.empty();
}

public LongIterableAssert anyMatch(LongPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public LongIterableAssert anyMatch(LongPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(LongPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate::test)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public LongIterableAssert contains(long... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.assertj.eclipse.collections.api;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.AnyElementShouldMatch.anyElementShouldMatch;
import static org.assertj.core.error.ElementsShouldMatch.elementsShouldMatch;
import static org.assertj.core.error.ElementsShouldSatisfy.elementsShouldSatisfy;
import static org.assertj.core.error.ShouldContain.shouldContain;
Expand Down Expand Up @@ -85,6 +86,22 @@ private static Optional<UnsatisfiedRequirement> failsRequirements(ShortProcedure
return Optional.empty();
}

public ShortIterableAssert anyMatch(ShortPredicate predicate) {
return executeAssertion(() -> assertAnyMatch(predicate, PredicateDescription.GIVEN));
}

public ShortIterableAssert anyMatch(ShortPredicate predicate, String predicateDescription) {
return executeAssertion(() -> assertAnyMatch(predicate, new PredicateDescription(predicateDescription)));
}

private void assertAnyMatch(ShortPredicate predicate, PredicateDescription predicateDescription) {
isNotNull();
requireNonNull(predicate, "The predicate to evaluate should not be null");
if (actual.noneSatisfy(predicate)) {
throw assertionError(anyElementShouldMatch(actual, predicateDescription));
}
}

public ShortIterableAssert contains(short... values) {
return executeAssertion(() -> {
isNotNull();
Expand Down
Loading
Loading