Skip to content

Commit 23009a9

Browse files
authored
Deprecated and not used code (#213)
* Removes deprecated and not used code * Fixes licence headers
1 parent 0111c50 commit 23009a9

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

src/main/java/org/assertj/vavr/api/AbstractEitherAssert.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Comparator;
2424
import java.util.function.Consumer;
2525

26-
import static org.assertj.core.util.Preconditions.checkArgument;
2726
import static org.assertj.vavr.api.EitherShouldBeLeft.shouldBeLeft;
2827
import static org.assertj.vavr.api.EitherShouldBeRight.shouldBeRight;
2928
import static org.assertj.vavr.api.EitherShouldContain.*;
@@ -255,10 +254,6 @@ public SELF usingDefaultRightValueComparator() {
255254
return myself;
256255
}
257256

258-
private void checkNotNull(Object expectedValue) {
259-
checkArgument(expectedValue != null, "The expected value should not be <null>.");
260-
}
261-
262257
private void assertIsRight() {
263258
isNotNull();
264259
if (actual.isLeft()) throwAssertionError(shouldBeRight(actual));

src/main/java/org/assertj/vavr/api/AbstractMapAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.function.BiConsumer;
2727
import java.util.stream.StreamSupport;
2828

29+
import static java.util.Objects.requireNonNull;
2930
import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty;
3031
import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty;
3132
import static org.assertj.core.error.ShouldHaveSameSizeAs.shouldHaveSameSizeAs;
@@ -38,7 +39,6 @@
3839
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
3940
import static org.assertj.core.util.Arrays.array;
4041
import static org.assertj.core.util.IterableUtil.sizeOf;
41-
import static org.assertj.core.util.Preconditions.checkNotNull;
4242

4343
/**
4444
* Assertions for {@link Map}.
@@ -68,7 +68,7 @@ abstract class AbstractMapAssert<SELF extends AbstractMapAssert<SELF, ACTUAL, KE
6868
* @throws AssertionError if one or more entries don't satisfy the given requirements.
6969
*/
7070
public SELF allSatisfy(BiConsumer<? super KEY, ? super VALUE> entryRequirements) {
71-
checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
71+
requireNonNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
7272
isNotNull();
7373
actual.forEach(entry -> entryRequirements.accept(entry._1, entry._2));
7474
return myself;
@@ -405,7 +405,7 @@ public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) {
405405
@Override
406406
public SELF hasSameSizeAs(Iterable<?> other) {
407407
isNotNull();
408-
checkNotNull(other, "The other Iterable to compare actual size with should not be null");
408+
requireNonNull(other, "The other Iterable to compare actual size with should not be null");
409409
final long expectedSize = sizeOf(other);
410410
if (actual.size() != expectedSize)
411411
throwAssertionError(shouldHaveSameSizeAs(actual, other, actual.size(), expectedSize));

src/main/java/org/assertj/vavr/api/AbstractMultimapAssert.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.function.BiConsumer;
2727
import java.util.stream.StreamSupport;
2828

29+
import static java.util.Objects.requireNonNull;
2930
import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty;
3031
import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty;
3132
import static org.assertj.core.error.ShouldHaveSameSizeAs.shouldHaveSameSizeAs;
@@ -38,7 +39,6 @@
3839
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
3940
import static org.assertj.core.util.Arrays.array;
4041
import static org.assertj.core.util.IterableUtil.sizeOf;
41-
import static org.assertj.core.util.Preconditions.checkNotNull;
4242

4343
abstract class AbstractMultimapAssert<SELF extends AbstractMultimapAssert<SELF, ACTUAL, KEY, VALUE>, ACTUAL extends Multimap<KEY, VALUE>, KEY, VALUE>
4444
extends AbstractValueAssert<SELF, ACTUAL> implements EnumerableAssert<SELF, Tuple2<? extends KEY, ? extends VALUE>> {
@@ -138,7 +138,7 @@ public SELF containsExactly(@SuppressWarnings("unchecked") Tuple2<? extends KEY,
138138
* @throws AssertionError if one or more entries don't satisfy the given requirements.
139139
*/
140140
public SELF allSatisfy(BiConsumer<? super KEY, ? super VALUE> entryRequirements) {
141-
checkNotNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
141+
requireNonNull(entryRequirements, "The BiConsumer<K, V> expressing the assertions requirements must not be null");
142142
isNotNull();
143143
actual.forEach(entry -> entryRequirements.accept(entry._1, entry._2));
144144
return myself;
@@ -399,7 +399,7 @@ public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) {
399399
@Override
400400
public SELF hasSameSizeAs(Iterable<?> other) {
401401
isNotNull();
402-
checkNotNull(other, "The other Iterable to compare actual size with should not be null");
402+
requireNonNull(other, "The other Iterable to compare actual size with should not be null");
403403
final long expectedSize = sizeOf(other);
404404
if (actual.size() != expectedSize)
405405
throwAssertionError(shouldHaveSameSizeAs(actual, other, actual.size(), expectedSize));

src/main/java/org/assertj/vavr/api/AbstractSeqAssert.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
import java.util.function.Consumer;
2727

2828
import static java.lang.String.format;
29+
import static java.util.Objects.requireNonNull;
2930
import static org.assertj.core.error.ShouldBeSorted.shouldHaveComparableElementsAccordingToGivenComparator;
3031
import static org.assertj.core.error.ShouldContainAtIndex.shouldContainAtIndex;
3132
import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty;
3233
import static org.assertj.core.error.ShouldNotContainAtIndex.shouldNotContainAtIndex;
33-
import static org.assertj.core.util.Preconditions.checkNotNull;
3434
import static org.assertj.vavr.api.SeqShouldBeAtIndex.shouldBeAtIndex;
3535
import static org.assertj.vavr.api.SeqShouldBeSorted.*;
3636
import static org.assertj.vavr.api.SeqShouldHaveAtIndex.shouldHaveAtIndex;
@@ -292,18 +292,18 @@ public SELF isSortedAccordingTo(Comparator<? super ELEMENT> comparator) {
292292
*/
293293
public SELF satisfies(Consumer<? super ELEMENT> requirements, Index index) {
294294
isNotNull();
295-
checkNotNull(requirements, "The Consumer expressing the assertions requirements must not be null");
295+
requireNonNull(requirements, "The Consumer expressing the assertions requirements must not be null");
296296
assertIndexIsValid(index);
297297
requirements.accept(actual.get(index.value));
298298
return myself;
299299
}
300300

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

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

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

338337
private void assertIndexIsValid(Index index) {
339-
checkNotNull(index, "Index should not be null");
338+
requireNonNull(index, "Index should not be null");
340339
final int maximum = actual.size() - 1;
341340
if (index.value > maximum) {
342341
String errorMessage = "Index should be between <0> and <%d> (inclusive) but was:%n <%d>";

src/main/java/org/assertj/vavr/api/VavrInstanceOfAssertFactories.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
99
* specific language governing permissions and limitations under the License.
1010
*
11-
* Copyright 2017-2023 the original author or authors.
11+
* Copyright 2017-2024 the original author or authors.
1212
*/
1313
package org.assertj.vavr.api;
1414

src/test/java/org/assertj/vavr/api/VavrInstanceOfAssertFactoriesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
99
* specific language governing permissions and limitations under the License.
1010
*
11-
* Copyright 2017-2023 the original author or authors.
11+
* Copyright 2017-2024 the original author or authors.
1212
*/
1313
package org.assertj.vavr.api;
1414

0 commit comments

Comments
 (0)