Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated and not used code #213

Merged
merged 2 commits into from
Feb 15, 2024
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 @@ -23,7 +23,6 @@
import java.util.Comparator;
import java.util.function.Consumer;

import static org.assertj.core.util.Preconditions.checkArgument;
import static org.assertj.vavr.api.EitherShouldBeLeft.shouldBeLeft;
import static org.assertj.vavr.api.EitherShouldBeRight.shouldBeRight;
import static org.assertj.vavr.api.EitherShouldContain.*;
Expand Down Expand Up @@ -255,10 +254,6 @@ public SELF usingDefaultRightValueComparator() {
return myself;
}

private void checkNotNull(Object expectedValue) {
checkArgument(expectedValue != null, "The expected value should not be <null>.");
}

private void assertIsRight() {
isNotNull();
if (actual.isLeft()) throwAssertionError(shouldBeRight(actual));
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/assertj/vavr/api/AbstractMapAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.function.BiConsumer;
import java.util.stream.StreamSupport;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty;
import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty;
import static org.assertj.core.error.ShouldHaveSameSizeAs.shouldHaveSameSizeAs;
Expand All @@ -38,7 +39,6 @@
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
import static org.assertj.core.util.Arrays.array;
import static org.assertj.core.util.IterableUtil.sizeOf;
import static org.assertj.core.util.Preconditions.checkNotNull;

/**
* Assertions for {@link Map}.
Expand Down Expand Up @@ -68,7 +68,7 @@ abstract class AbstractMapAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, KE
* @throws AssertionError if one or more entries don't satisfy the given requirements.
*/
public SELF allSatisfy(BiConsumer<? super KEY, ? super VALUE> entryRequirements) {
checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
requireNonNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
isNotNull();
actual.forEach(entry -> entryRequirements.accept(entry._1, entry._2));
return myself;
Expand Down Expand Up @@ -405,7 +405,7 @@ public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) {
@Override
public SELF hasSameSizeAs(Iterable<?> other) {
isNotNull();
checkNotNull(other, "The other Iterable to compare actual size with should not be null");
requireNonNull(other, "The other Iterable to compare actual size with should not be null");
final long expectedSize = sizeOf(other);
if (actual.size() != expectedSize)
throwAssertionError(shouldHaveSameSizeAs(actual, other, actual.size(), expectedSize));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.function.BiConsumer;
import java.util.stream.StreamSupport;

import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty;
import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty;
import static org.assertj.core.error.ShouldHaveSameSizeAs.shouldHaveSameSizeAs;
Expand All @@ -38,7 +39,6 @@
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
import static org.assertj.core.util.Arrays.array;
import static org.assertj.core.util.IterableUtil.sizeOf;
import static org.assertj.core.util.Preconditions.checkNotNull;

abstract class AbstractMultimapAssert<SELF extends AbstractMultimapAssert<SELF, ACTUAL, KEY, VALUE>, ACTUAL extends Multimap<KEY, VALUE>, KEY, VALUE>
extends AbstractValueAssert<SELF, ACTUAL> implements EnumerableAssert<SELF, Tuple2<? extends KEY, ? extends VALUE>> {
Expand Down Expand Up @@ -138,7 +138,7 @@ public SELF containsExactly(@SuppressWarnings("unchecked") Tuple2<? extends KEY,
* @throws AssertionError if one or more entries don't satisfy the given requirements.
*/
public SELF allSatisfy(BiConsumer<? super KEY, ? super VALUE> entryRequirements) {
checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
requireNonNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
isNotNull();
actual.forEach(entry -> entryRequirements.accept(entry._1, entry._2));
return myself;
Expand Down Expand Up @@ -399,7 +399,7 @@ public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) {
@Override
public SELF hasSameSizeAs(Iterable<?> other) {
isNotNull();
checkNotNull(other, "The other Iterable to compare actual size with should not be null");
requireNonNull(other, "The other Iterable to compare actual size with should not be null");
final long expectedSize = sizeOf(other);
if (actual.size() != expectedSize)
throwAssertionError(shouldHaveSameSizeAs(actual, other, actual.size(), expectedSize));
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/org/assertj/vavr/api/AbstractSeqAssert.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import java.util.function.Consumer;

import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ShouldBeSorted.shouldHaveComparableElementsAccordingToGivenComparator;
import static org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex;
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
import static org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.vavr.api.SeqShouldBeAtIndex.shouldBeAtIndex;
import static org.assertj.vavr.api.SeqShouldBeSorted.*;
import static org.assertj.vavr.api.SeqShouldHaveAtIndex.shouldHaveAtIndex;
Expand Down Expand Up @@ -292,18 +292,18 @@ public SELF isSortedAccordingTo(Comparator<? super ELEMENT> comparator) {
*/
public SELF satisfies(Consumer<? super ELEMENT> requirements, Index index) {
isNotNull();
checkNotNull(requirements, "The Consumer expressing the assertions requirements must not be null");
requireNonNull(requirements, "The Consumer expressing the assertions requirements must not be null");
assertIndexIsValid(index);
requirements.accept(actual.get(index.value));
return myself;
}

private void assertIsSortedAccordingToComparator(Comparator<?> comparator) {
checkNotNull(comparator, "The given comparator should not be null");
requireNonNull(comparator, "The given comparator should not be null");
try {
// Empty collections are considered sorted even if comparator can't be applied to their element type
// We can't verify that point because of erasure type at runtime.
if (actual.size() == 0) return;
if (actual.isEmpty()) return;
Comparator rawComparator = comparator;
if (actual.size() == 1) {
// Compare unique element with itself to verify that it is compatible with comparator (a ClassCastException is
Expand All @@ -320,12 +320,11 @@ private void assertIsSortedAccordingToComparator(Comparator<?> comparator) {
throwAssertionError(
shouldHaveComparableElementsAccordingToGivenComparator(actual, comparator));
}
return;
}

private void assertConditionIsMetAtIndex(Condition<? super ELEMENT> condition, Index index, Runnable errorProvider) {
isNotNull();
checkNotNull(condition, "The condition to evaluate should not be null");
requireNonNull(condition, "The condition to evaluate should not be null");

assertNotEmpty();
assertIndexIsValid(index);
Expand All @@ -336,7 +335,7 @@ private void assertConditionIsMetAtIndex(Condition<? super ELEMENT> condition, I
}

private void assertIndexIsValid(Index index) {
checkNotNull(index, "Index should not be null");
requireNonNull(index, "Index should not be null");
final int maximum = actual.size() - 1;
if (index.value > maximum) {
String errorMessage = "Index should be between <0> and <%d> (inclusive) but was:%n <%d>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2023 the original author or authors.
* Copyright 2017-2024 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* Copyright 2017-2023 the original author or authors.
* Copyright 2017-2024 the original author or authors.
*/
package org.assertj.vavr.api;

Expand Down