Skip to content

Commit

Permalink
Bump org.assertj:assertj-core from 3.24.2 to 3.25.2 (#208)
Browse files Browse the repository at this point in the history
* Bump org.assertj:assertj-core from 3.24.2 to 3.25.2

Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.24.2 to 3.25.2.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](assertj/assertj@assertj-build-3.24.2...assertj-build-3.25.2)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fixes failing assertions after upgrade

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michał Chmielarz <michal.chmielarz@gmail.com>
  • Loading branch information
dependabot[bot] and mchmielarz committed Jan 27, 2024
1 parent e1f6f8b commit fa20d96
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<version>3.25.2</version>
</dependency>
<dependency>
<groupId>io.vavr</groupId>
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/assertj/vavr/internal/Maps.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.util.function.Predicate;

import static io.vavr.Predicates.not;
import static java.util.Objects.deepEquals;
import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ElementsShouldBe.elementsShouldBe;
import static org.assertj.core.error.ShouldContain.shouldContain;
import static org.assertj.core.error.ShouldContainExactly.elementsDifferAtIndex;
Expand All @@ -41,9 +43,7 @@
import static org.assertj.core.internal.Arrays.assertIsArray;
import static org.assertj.core.internal.CommonValidations.failIfEmptySinceActualIsNotEmpty;
import static org.assertj.core.internal.CommonValidations.hasSameSizeAsCheck;
import static org.assertj.core.util.Objects.areEqual;
import static org.assertj.core.util.Preconditions.checkArgument;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.vavr.api.ShouldNotContainValues.shouldNotContainValues;

public final class Maps {
Expand Down Expand Up @@ -89,7 +89,7 @@ public <K, V> void assertContainsAnyOf(AssertionInfo info, Map<K, V> actual,
Tuple2<K, V>[] entries) {
doCommonContainsCheck(info, actual, entries);
if (actual.isEmpty() && entries.length == 0) return;
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
for (Tuple2<? extends K, ? extends V> entry : entries) {
if (containsEntry(actual, entry)) return;
}
Expand All @@ -114,7 +114,7 @@ public <K, V> void assertContains(AssertionInfo info, Map<K, V> actual,
Tuple2<K, V>[] entries) {
doCommonContainsCheck(info, actual, entries);
if (actual.isEmpty() && entries.length == 0) return;
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
final Set<Tuple2<K, V>> notFound = Array.of(entries).filter(entryNotPresentIn(actual)).toSet();
if (isNotEmpty(notFound)) {
throw failures.failure(info, shouldContain(actual, entries, notFound));
Expand All @@ -139,7 +139,7 @@ public <K, V> void assertDoesNotContain(AssertionInfo info, Map<K, V> actual,
Tuple2<K, V>[] entries) {
failIfNullOrEmpty(entries);
assertNotNull(info, actual);
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
final Set<Tuple2<K, V>> found = Array.of(entries).filter(actual::contains).toSet();
if (isNotEmpty(found)) {
throw failures.failure(info, shouldNotContain(actual, entries, found));
Expand Down Expand Up @@ -308,7 +308,7 @@ public <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual,
public <K, V> void assertContainsValues(AssertionInfo info, Map<K, V> actual,
@SuppressWarnings("unchecked") V... values) {
assertNotNull(info, actual);
checkNotNull(values, "The array of values to look for should not be null");
requireNonNull(values, "The array of values to look for should not be null");
if (actual.isEmpty() && values.length == 0) return;

Set<V> expected = HashSet.of(values);
Expand All @@ -331,7 +331,7 @@ public <K, V> void assertContainsValues(AssertionInfo info, Map<K, V> actual,
public <K, V> void assertDoesNotContainValues(AssertionInfo info, Map<K, V> actual,
@SuppressWarnings("unchecked") V... values) {
assertNotNull(info, actual);
checkNotNull(values, "The array of values to look for should not be null");
requireNonNull(values, "The array of values to look for should not be null");
if (actual.isEmpty() && values.length == 0) return;

Set<V> expected = HashSet.of(values);
Expand Down Expand Up @@ -407,8 +407,8 @@ private <K, V> boolean doCommonEmptinessChecks(Map<K, V> actual, K[] keys) {
}

private <K, V> boolean containsEntry(Map<K, V> actual, Tuple2<? extends K, ? extends V> entry) {
checkNotNull(entry, "Entries to look for should not be null");
return actual.containsKey(entry._1) && areEqual(actual.get(entry._1).get(), entry._2);
requireNonNull(entry, "Entries to look for should not be null");
return actual.containsKey(entry._1) && deepEquals(actual.get(entry._1).get(), entry._2);
}

private static <K, V> void failIfEmpty(Tuple2<? extends K, ? extends V>[] entries) {
Expand All @@ -429,19 +429,19 @@ private static <K, V> void failIfNullOrEmpty(Tuple2<? extends K, ? extends V>[]
}

private static <K, V> void failIfNull(Tuple2<? extends K, ? extends V>[] entries) {
checkNotNull(entries, "The array of entries to look for should not be null");
requireNonNull(entries, "The array of entries to look for should not be null");
}

private static <K, V> void failIfNull(Iterable<Tuple2<K, V>> entries) {
checkNotNull(entries, "The entries to look for should not be null");
requireNonNull(entries, "The entries to look for should not be null");
}

private static <K> void failIfNull(K[] keys) {
checkNotNull(keys, "The array of keys to look for should not be null");
requireNonNull(keys, "The array of keys to look for should not be null");
}

private static <K> boolean areNotEqual(K actualKey, K expectedKey) {
return !areEqual(actualKey, expectedKey);
return !deepEquals(actualKey, expectedKey);
}

private static void assertNotNull(AssertionInfo info, Map<?, ?> actual) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/org/assertj/vavr/internal/Multimaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.util.function.Predicate;

import static io.vavr.Predicates.not;
import static java.util.Objects.deepEquals;
import static java.util.Objects.requireNonNull;
import static org.assertj.core.error.ElementsShouldBe.elementsShouldBe;
import static org.assertj.core.error.ShouldContain.shouldContain;
import static org.assertj.core.error.ShouldContainAnyOf.shouldContainAnyOf;
Expand All @@ -41,9 +43,7 @@
import static org.assertj.core.internal.Arrays.assertIsArray;
import static org.assertj.core.internal.CommonValidations.failIfEmptySinceActualIsNotEmpty;
import static org.assertj.core.internal.CommonValidations.hasSameSizeAsCheck;
import static org.assertj.core.util.Objects.areEqual;
import static org.assertj.core.util.Preconditions.checkArgument;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.vavr.api.ShouldNotContainValues.shouldNotContainValues;

public final class Multimaps {
Expand Down Expand Up @@ -91,7 +91,7 @@ public <K, V> void assertContainsAnyOf(AssertionInfo info, Multimap<K, V> actual
Tuple2<K, V>[] entries) {
doCommonContainsCheck(info, actual, entries);
if (actual.isEmpty() && entries.length == 0) return;
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
for (Tuple2<? extends K, ? extends V> entry : entries) {
if (containsEntry(actual, entry)) return;
}
Expand All @@ -116,7 +116,7 @@ public <K, V> void assertContains(AssertionInfo info, Multimap<K, V> actual,
Tuple2<K, V>[] entries) {
doCommonContainsCheck(info, actual, entries);
if (actual.isEmpty() && entries.length == 0) return;
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
final Set<Tuple2<K, V>> notFound = Array.of(entries).filter(entryNotPresentIn(actual)).toSet();
if (isNotEmpty(notFound)) {
throw failures.failure(info, shouldContain(actual, entries, notFound));
Expand Down Expand Up @@ -214,7 +214,7 @@ public <K, V> void assertDoesNotContain(AssertionInfo info, Multimap<K, V> actua
Tuple2<K, V>[] entries) {
failIfNullOrEmpty(entries);
assertNotNull(info, actual);
failIfEmptySinceActualIsNotEmpty(entries);
failIfEmptySinceActualIsNotEmpty(info, failures, actual, entries);
final Set<Tuple2<K, V>> found = Array.of(entries).filter(actual::contains).toSet();
if (isNotEmpty(found)) {
throw failures.failure(info, shouldNotContain(actual, entries, found));
Expand Down Expand Up @@ -327,7 +327,7 @@ public <K, V> void assertContainsValue(AssertionInfo info, Multimap<K, V> actual
public <K, V> void assertContainsValues(AssertionInfo info, Multimap<K, V> actual,
@SuppressWarnings("unchecked") V... values) {
assertNotNull(info, actual);
checkNotNull(values, "The array of values to look for should not be null");
requireNonNull(values, "The array of values to look for should not be null");
if (actual.isEmpty() && values.length == 0) return;

Set<V> expected = HashSet.of(values);
Expand Down Expand Up @@ -366,7 +366,7 @@ public <K, V> void assertDoesNotContainValue(AssertionInfo info, Multimap<K, V>
public <K, V> void assertDoesNotContainValues(AssertionInfo info, Multimap<K, V> actual,
@SuppressWarnings("unchecked") V... values) {
assertNotNull(info, actual);
checkNotNull(values, "The array of values to look for should not be null");
requireNonNull(values, "The array of values to look for should not be null");
if (actual.isEmpty() && values.length == 0) return;

Set<V> expected = HashSet.of(values);
Expand Down Expand Up @@ -423,12 +423,12 @@ private static <K, V> Multimap<K, V> asLinkedMultimap(Tuple2<? extends K, ? exte
}

private <K, V> boolean containsEntry(Multimap<K, V> actual, Tuple2<? extends K, ? extends V> entry) {
checkNotNull(entry, "Entry to look for should not be null");
requireNonNull(entry, "Entry to look for should not be null");
return actual.containsKey(entry._1) && actual.get(entry._1).get().contains(entry._2);
}

private static <K> boolean areNotEqual(K actualKey, K expectedKey) {
return !areEqual(actualKey, expectedKey);
return !deepEquals(actualKey, expectedKey);
}

private static <K, V> void failIfNullOrEmpty(Tuple2<? extends K, ? extends V>[] entries) {
Expand All @@ -437,15 +437,15 @@ private static <K, V> void failIfNullOrEmpty(Tuple2<? extends K, ? extends V>[]
}

private static <K, V> void failIfNull(Iterable<Tuple2<K, V>> entries) {
checkNotNull(entries, "The entries should not be null");
requireNonNull(entries, "The entries should not be null");
}

private static <K> void failIfNull(K[] keys) {
checkNotNull(keys, "The array of keys to look for should not be null");
requireNonNull(keys, "The array of keys to look for should not be null");
}

private static <K, V> void failIfNull(Tuple2<? extends K, ? extends V>[] entries) {
checkNotNull(entries, "The array of entries should not be null");
requireNonNull(entries, "The array of entries should not be null");
}

private static <K, V> void failIfEmpty(Iterable<Tuple2<K, V>> entries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ void should_fail_if_Map_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).containsAllEntriesOf(List.empty())
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMap((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ void should_fail_if_Map_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).containsAnyOf(entries)
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMap((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ void should_fail_if_Map_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).contains(entries)
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMap((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ void should_fail_if_Multimap_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).containsAllEntriesOf(List.empty())
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMultimap[List]((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ void should_fail_if_Multimap_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).containsAnyOf(entries)
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMultimap[List]((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ void should_fail_if_Multimap_is_not_empty_and_entries_is_an_empty_array() {
() -> assertThat(actual).contains(entries)
)
.isInstanceOf(AssertionError.class)
.hasMessage("actual is not empty while group of values to look for is.");
.hasMessage("\n" +
"Actual:\n" +
" HashMultimap[List]((key1, value1), (key3, value3))\n" +
"is not empty while group of values to look for is.");
}

@Test
Expand Down

0 comments on commit fa20d96

Please sign in to comment.