From aff4cd3d1e12b6ff311d8dbf96a7b0be04894196 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Fri, 7 Feb 2025 23:05:24 -0500 Subject: [PATCH 01/39] Initial scaffold of AbstractMultimapAssert Getting the basic structure in place and copying over one assertion (contains) --- pom.xml | 6 ++ .../org/assertj/eclipse/collections/Main.java | 33 ------- .../eclipse/collections/api/Assertions.java | 28 ++++++ ...ipseCollectionsSoftAssertionsProvider.java | 25 ++++++ .../collections/api/SoftAssertions.java | 16 ++++ .../api/multimap/AbstractMultimapAssert.java | 49 ++++++++++ .../api/multimap/bag/BagMultimapAssert.java | 15 ++++ .../api/multimap/bag/package-info.java | 1 + .../api/multimap/list/ListMultimapAssert.java | 16 ++++ .../api/multimap/list/package-info.java | 1 + .../api/multimap/package-info.java | 1 + .../api/multimap/set/SetMultimapAssert.java | 15 ++++ .../api/multimap/set/package-info.java | 1 + .../eclipse/collections/api/package-info.java | 1 + ...tractMultimapAssert_Contains_Contract.java | 90 +++++++++++++++++++ .../bag/BagMultimapAssert_Contains_Test.java | 61 +++++++++++++ .../ListMultimapAssert_Contains_Test.java | 61 +++++++++++++ .../set/SetMultimapAssert_Contains_Test.java | 61 +++++++++++++ 18 files changed, 448 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/org/assertj/eclipse/collections/Main.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/Assertions.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java create mode 100644 src/main/java/org/assertj/eclipse/collections/api/package-info.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java diff --git a/pom.xml b/pom.xml index 7658305..10d04ed 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,12 @@ ${eclipse-collections.version} provided + + org.eclipse.collections + eclipse-collections + ${eclipse-collections.version} + provided + org.junit.jupiter diff --git a/src/main/java/org/assertj/eclipse/collections/Main.java b/src/main/java/org/assertj/eclipse/collections/Main.java deleted file mode 100644 index 05edd14..0000000 --- a/src/main/java/org/assertj/eclipse/collections/Main.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections; - -/** - * Main - * @see org.assertj.core.api.Assertions - */ -public class Main { - - /** - * main - * - * @param args args - */ - public static void main(String[] args) { - System.out.println("Hello, World!"); - } - - private Main() { - } - -} diff --git a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java new file mode 100644 index 0000000..07587fd --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java @@ -0,0 +1,28 @@ +package org.assertj.eclipse.collections.api; + +import org.assertj.core.util.CheckReturnValue; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; + +@CheckReturnValue +public class Assertions { + private Assertions() { + throw new UnsupportedOperationException("Utility class"); + } + + public static BagMultimapAssert assertThat(BagMultimap actual) { + return BagMultimapAssert.assertThat(actual); + } + + public static ListMultimapAssert assertThat(ListMultimap actual) { + return ListMultimapAssert.assertThat(actual); + } + + public static SetMultimapAssert assertThat(SetMultimap actual) { + return SetMultimapAssert.assertThat(actual); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java new file mode 100644 index 0000000..bca67d0 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java @@ -0,0 +1,25 @@ +package org.assertj.eclipse.collections.api; + +import org.assertj.core.api.SoftAssertionsProvider; +import org.assertj.core.util.CheckReturnValue; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; + +@CheckReturnValue +public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider { + default BagMultimapAssert assertThat(BagMultimap actual) { + return this.proxy(BagMultimapAssert.class, BagMultimap.class, actual); + } + + default ListMultimapAssert assertThat(ListMultimap actual) { + return this.proxy(ListMultimapAssert.class, ListMultimap.class, actual); + } + + default SetMultimapAssert assertThat(SetMultimap actual) { + return this.proxy(SetMultimapAssert.class, SetMultimap.class, actual); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java new file mode 100644 index 0000000..60e0112 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java @@ -0,0 +1,16 @@ +package org.assertj.eclipse.collections.api; + +import org.assertj.core.api.AbstractSoftAssertions; +import org.assertj.core.api.SoftAssertionsProvider; + +import java.util.function.Consumer; + +public class SoftAssertions extends AbstractSoftAssertions implements EclipseCollectionsSoftAssertionsProvider { + public SoftAssertions() { + // Do nothing + } + + public static void assertSoftly(Consumer softly) { + SoftAssertionsProvider.assertSoftly(SoftAssertions.class, softly); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java new file mode 100644 index 0000000..d95162b --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -0,0 +1,49 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.error.ShouldContain.shouldContain; + +import java.util.Map; + +import org.assertj.core.api.AbstractObjectAssert; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.list.MutableList; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.tuple.Tuples; + +/** + * Base class for all implementations of assertions for {@link Multimap}s. + * + * @param the "self" type of this assertion class. + * @param the type of the "actual" value. + * @param the type of keys in the Multimap. + * @param the type of values in the Multimap. + */ +public class AbstractMultimapAssert, ACTUAL extends Multimap, KEY, VALUE> + extends AbstractObjectAssert { + + protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { + super(actual, selfType); + } + + @SafeVarargs + public final SELF contains(Pair... entries) { + return this.containsForProxy(Lists.mutable.of(entries)); + } + + @SafeVarargs + public final SELF contains(Map.Entry... entries) { + MutableList> pairs = Lists.mutable.of(entries).collect(Tuples::pairFrom); + return this.containsForProxy(pairs); + } + + protected SELF containsForProxy(MutableList> entries) { + this.isNotNull(); + MutableList> entriesNotFound = entries + .reject(entry -> this.actual.containsKeyAndValue(entry.getOne(), entry.getTwo())); + if (entriesNotFound.isEmpty()) { + return this.myself; + } + throw this.assertionError(shouldContain(this.actual, entries, entriesNotFound)); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java new file mode 100644 index 0000000..2b2f5b9 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java @@ -0,0 +1,15 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; +import org.eclipse.collections.api.multimap.bag.BagMultimap; + +public class BagMultimapAssert extends AbstractMultimapAssert, BagMultimap, KEY, VALUE> { + + public static BagMultimapAssert assertThat(BagMultimap actual) { + return new BagMultimapAssert<>(actual); + } + + public BagMultimapAssert(BagMultimap keyvalueBagMultimap) { + super(keyvalueBagMultimap, BagMultimapAssert.class); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java new file mode 100644 index 0000000..bba55c8 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.api.multimap.bag; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java new file mode 100644 index 0000000..1d8bc79 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java @@ -0,0 +1,16 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; +import org.eclipse.collections.api.multimap.list.ListMultimap; + +public class ListMultimapAssert + extends AbstractMultimapAssert, ListMultimap, KEY, VALUE> { + + public static ListMultimapAssert assertThat(ListMultimap actual) { + return new ListMultimapAssert<>(actual); + } + + public ListMultimapAssert(ListMultimap actual) { + super(actual, ListMultimapAssert.class); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java new file mode 100644 index 0000000..6dd57a4 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.api.multimap.list; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java new file mode 100644 index 0000000..1b47aeb --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.api.multimap; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java new file mode 100644 index 0000000..a8d9cd8 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java @@ -0,0 +1,15 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; +import org.eclipse.collections.api.multimap.set.SetMultimap; + +public class SetMultimapAssert extends AbstractMultimapAssert, SetMultimap, KEY, VALUE> { + + public static SetMultimapAssert assertThat(SetMultimap actual) { + return new SetMultimapAssert<>(actual); + } + + public SetMultimapAssert(SetMultimap actual) { + super(actual, SetMultimapAssert.class); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java new file mode 100644 index 0000000..228a0f9 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.api.multimap.set; diff --git a/src/main/java/org/assertj/eclipse/collections/api/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/package-info.java new file mode 100644 index 0000000..d8ac04a --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.api; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java new file mode 100644 index 0000000..d9c938e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java @@ -0,0 +1,90 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.tuple.Tuples; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_Contains_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + Pair[] expectedPairs(); + + Map.Entry[] expectedEntries(); + + Pair missingPair(); + + Map.Entry missingEntry(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void containsPairsPasses() { + this.assertion(this.testInput()).contains(this.expectedPairs()); + } + + @Test + default void containsPairsFails() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + this.assertion(this.testInput()).contains(this.missingPair())) + .withMessageContaining("Expecting") + .withMessageContaining("but could not find the following element(s)") + .withMessageContaining(this.missingPair().toString()); + } + + @Test + default void nullActualWithPair() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + this.assertion(this.nullInput()).contains(this.expectedPairs())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionsWithPairPasses() { + SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()) + .contains(this.expectedPairs())); + } + + @Test + default void containsEntriesPasses() { + this.assertion(this.testInput()).contains(this.expectedEntries()); + } + + @Test + default void containsEntriesFails() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + this.assertion(this.testInput()).contains(this.missingEntry())) + .withMessageContaining("Expecting") + .withMessageContaining("but could not find the following element(s)") + .withMessageContaining(Tuples.pairFrom(this.missingEntry()).toString()); + } + + @Test + default void nullActualWithEntry() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + this.assertion(this.nullInput()).contains(this.expectedEntries())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionsWithEntryPasses() { + SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()) + .contains(this.expectedEntries())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java new file mode 100644 index 0000000..e06455c --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] expectedPairs() { + return new Pair[]{pair("TOS", "McCoy"), pair("TNG", "Crusher")}; + } + + @Override + public Map.Entry[] expectedEntries() { + return new Map.Entry[]{pair("TOS", "McCoy").toEntry(), pair("TNG", "Crusher").toEntry()}; + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } + + @Override + public Map.Entry missingEntry() { + return missingPair().toEntry(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java new file mode 100644 index 0000000..3aee066 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] expectedPairs() { + return new Pair[]{pair("TNG", "Riker"), pair("DS9", "Kira")}; + } + + @Override + public Map.Entry[] expectedEntries() { + return new Map.Entry[]{pair("TNG", "Riker").toEntry(), pair("DS9", "Kira").toEntry()}; + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } + + @Override + public Map.Entry missingEntry() { + return missingPair().toEntry(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java new file mode 100644 index 0000000..d08e256 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] expectedPairs() { + return new Pair[]{pair("TNG", "Picard"), pair("DS9", "Sisko")}; + } + + @Override + public Map.Entry[] expectedEntries() { + return new Map.Entry[]{pair("TNG", "Picard").toEntry(), pair("DS9", "Sisko").toEntry()}; + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } + + @Override + public Map.Entry missingEntry() { + return missingPair().toEntry(); + } +} From b068f42d8c297be83904b0e29465e2ced829f4b7 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Fri, 7 Feb 2025 23:57:29 -0500 Subject: [PATCH 02/39] Add the containsKeys assertion --- .../api/multimap/AbstractMultimapAssert.java | 30 +++++++++ ...tMultimapAssert_ContainsKeys_Contract.java | 63 +++++++++++++++++++ .../BagMultimapAssert_ContainsKeys_Test.java | 46 ++++++++++++++ .../ListMultimapAssert_ContainsKeys_Test.java | 46 ++++++++++++++ .../SetMultimapAssert_ContainsKeys_Test.java | 46 ++++++++++++++ 5 files changed, 231 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index d95162b..d7ccf09 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -1,6 +1,7 @@ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.error.ShouldContain.shouldContain; +import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import java.util.Map; @@ -46,4 +47,33 @@ protected SELF containsForProxy(MutableList> entries) { } throw this.assertionError(shouldContain(this.actual, entries, entriesNotFound)); } + + /** + * Verifies that the actual {@link Multimap} contains the given keys. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key2", "Value2");
+   *
+   * // assertion will pass
+   * assertThat(multimap).containsKeys("Key1", "Key2");
+   *
+   * // assertion will fail
+   * assertThat(multimap).containsKeys("Key3");
+   * }
+ * + * @param keys the keys that are expected to be present in the {@link Multimap}. + * @return this assertion object. + * @throws AssertionError if the actual {@link Multimap} does not contain the given keys. + */ + public SELF containsKeys(KEY... keys) + { + this.isNotNull(); + MutableList keysNotFound = Lists.mutable.of(keys).reject(this.actual::containsKey); + if (keysNotFound.isEmpty()) + { + return this.myself; + } + throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); + } } diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java new file mode 100644 index 0000000..42f8d0a --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java @@ -0,0 +1,63 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_ContainsKeys_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + KEY[] expectedKeys(); + + KEY missingKey(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passes() { + assertion(testInput()).containsKeys(expectedKeys()); + } + + @Test + default void failsEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).containsKeys(expectedKeys())) + .withMessageContaining("Expecting actual") + .withMessageContaining("{}") + .withMessageContaining("to contain keys"); + } + + @Test + default void failsMissingKey() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsKeys(missingKey())) + .withMessageContaining("Expecting actual") + .withMessageContaining("to contain key") + .withMessageContaining(missingKey().toString()); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).containsKeys(expectedKeys())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsKeys(expectedKeys())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java new file mode 100644 index 0000000..9d0b47e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedKeys() { + return new String[]{"TOS", "TNG", "DS9"}; + } + + @Override + public String missingKey() { + return "DIS"; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java new file mode 100644 index 0000000..d59325f --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedKeys() { + return new String[]{"TOS", "TNG", "DS9"}; + } + + @Override + public String missingKey() { + return "DIS"; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java new file mode 100644 index 0000000..d4c9419 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedKeys() { + return new String[]{"TOS", "TNG", "DS9"}; + } + + @Override + public String missingKey() { + return "DIS"; + } +} From 543a93beb0eb78647fb764b61d2460ba7116b29a Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 08:47:38 -0500 Subject: [PATCH 03/39] Add the contains assertion --- .../api/multimap/AbstractMultimapAssert.java | 37 ++++++++++-- ...MultimapAssert_ContainsEntry_Contract.java | 58 +++++++++++++++++++ .../BagMultimapAssert_ContainsEntry_Test.java | 50 ++++++++++++++++ .../BagMultimapAssert_ContainsKeys_Test.java | 2 +- .../bag/BagMultimapAssert_Contains_Test.java | 2 +- ...ListMultimapAssert_ContainsEntry_Test.java | 50 ++++++++++++++++ .../ListMultimapAssert_ContainsKeys_Test.java | 2 +- .../ListMultimapAssert_Contains_Test.java | 2 +- .../SetMultimapAssert_ContainsEntry_Test.java | 50 ++++++++++++++++ .../SetMultimapAssert_ContainsKeys_Test.java | 2 +- .../set/SetMultimapAssert_Contains_Test.java | 2 +- 11 files changed, 247 insertions(+), 10 deletions(-) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index d7ccf09..df6f55b 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -27,6 +27,25 @@ protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { super(actual, selfType); } + /** + * Verifies that the actual {@link Multimap} contains the given entries. Entries are given in the form of {@link + * Pair} objects. + *

+ * Example: + *

{@code
+   *     Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key2", "Value2");
+   *
+   *     // assertion will pass
+   *     assertThat(multimap).contains(Tuples.pair("Key1", "Value1"), Tuples.pair("Key2", "Value2"));
+   *
+   *     // assertion will fail
+   *     assertThat(multimap).contains(Tuples.pair("Key1", "Value3"), Tuples.pair("Key2", "Value1"));
+   *     }
+ * + * @param entries the entries that are expected to be present in the {@link Multimap}. + * @return this assertion object. + * @throws AssertionError if the actual {@link Multimap} does not contain the given entries + */ @SafeVarargs public final SELF contains(Pair... entries) { return this.containsForProxy(Lists.mutable.of(entries)); @@ -48,6 +67,18 @@ protected SELF containsForProxy(MutableList> entries) { throw this.assertionError(shouldContain(this.actual, entries, entriesNotFound)); } + /** + * Verifies that the actual {@link Multimap} contains the given key-value entry. + * + * @param key the key that is expected to be present in the {@link Multimap}. + * @param value the value that is expected to be associated with the given key in the {@link Multimap}. + * @return this assertion object for method chaining. + * @throws AssertionError if the actual {@link Multimap} does not contain the given key-value entry. + */ + public SELF containsEntry(KEY key, VALUE value) { + return this.contains(Tuples.pair(key, value)); + } + /** * Verifies that the actual {@link Multimap} contains the given keys. *

@@ -66,12 +97,10 @@ protected SELF containsForProxy(MutableList> entries) { * @return this assertion object. * @throws AssertionError if the actual {@link Multimap} does not contain the given keys. */ - public SELF containsKeys(KEY... keys) - { + public SELF containsKeys(KEY... keys) { this.isNotNull(); MutableList keysNotFound = Lists.mutable.of(keys).reject(this.actual::containsKey); - if (keysNotFound.isEmpty()) - { + if (keysNotFound.isEmpty()) { return this.myself; } throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java new file mode 100644 index 0000000..d259fb6 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java @@ -0,0 +1,58 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.multimap.list.ImmutableListMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_ContainsEntry_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + Pair expectedEntry(); + + Pair missingPair(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passes() { + assertion(testInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo()); + } + + @Test + default void failsEmpty() { + ImmutableListMultimap multimap = Multimaps.immutable.list.empty(); + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())) + .withMessageContaining("Expecting") + .withMessageContaining("to contain") + .withMessageContaining("but could not find the following element(s)"); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java new file mode 100644 index 0000000..1a62e01 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; +import org.eclipse.collections.impl.tuple.Tuples; + +class BagMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair expectedEntry() { + return Tuples.pair("ENT", "Reed"); + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java index 9d0b47e..56d6897 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java @@ -7,7 +7,7 @@ import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class BagMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, BagMultimapAssert> { +class BagMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, BagMultimapAssert> { @Override public BagMultimap testInput() { MutableBagMultimap multimap = Multimaps.mutable.bag.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java index e06455c..1c51703 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java @@ -12,7 +12,7 @@ import org.eclipse.collections.api.tuple.Pair; import org.eclipse.collections.impl.factory.Multimaps; -public class BagMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, BagMultimapAssert> { +class BagMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, BagMultimapAssert> { @Override public BagMultimap testInput() { MutableBagMultimap multimap = Multimaps.mutable.bag.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java new file mode 100644 index 0000000..970f90c --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; +import org.eclipse.collections.impl.tuple.Tuples; + +class ListMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.empty(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair expectedEntry() { + return Tuples.pair("ENT", "Reed"); + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java index d59325f..40ed369 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java @@ -7,7 +7,7 @@ import org.eclipse.collections.api.multimap.list.MutableListMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class ListMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, ListMultimapAssert> { +class ListMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, ListMultimapAssert> { @Override public ListMultimap testInput() { MutableListMultimap multimap = Multimaps.mutable.list.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java index 3aee066..76b11e1 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java @@ -12,7 +12,7 @@ import org.eclipse.collections.api.tuple.Pair; import org.eclipse.collections.impl.factory.Multimaps; -public class ListMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, ListMultimapAssert> { +class ListMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, ListMultimapAssert> { @Override public ListMultimap testInput() { MutableListMultimap multimap = Multimaps.mutable.list.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java new file mode 100644 index 0000000..b62ae03 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; +import org.eclipse.collections.impl.tuple.Tuples; + +class SetMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.empty(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair expectedEntry() { + return Tuples.pair("ENT", "Reed"); + } + + @Override + public Pair missingPair() { + return pair("VOY", "Kes"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java index d4c9419..418af53 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java @@ -7,7 +7,7 @@ import org.eclipse.collections.api.multimap.set.SetMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class SetMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, SetMultimapAssert> { +class SetMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, SetMultimapAssert> { @Override public SetMultimap testInput() { MutableSetMultimap multimap = Multimaps.mutable.set.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java index d08e256..07aa330 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java @@ -12,7 +12,7 @@ import org.eclipse.collections.api.tuple.Pair; import org.eclipse.collections.impl.factory.Multimaps; -public class SetMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, SetMultimapAssert> { +class SetMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, SetMultimapAssert> { @Override public SetMultimap testInput() { MutableSetMultimap multimap = Multimaps.mutable.set.of(); From 5e9264c8efb5ede268ef4b521caccfbb617f5166 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 08:50:47 -0500 Subject: [PATCH 04/39] Docs --- .../collections/api/multimap/AbstractMultimapAssert.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index df6f55b..b1200f3 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -51,6 +51,14 @@ public final SELF contains(Pair... entries) { return this.containsForProxy(Lists.mutable.of(entries)); } + /** + * Verifies that the actual {@code Multimap} contains the provided entries. Entries are provided as + * an array of {@code Map.Entry} objects. + * + * @param entries the entries that are expected to be contained within the {@code Multimap}. + * @return this assertion object for method chaining. + * @throws AssertionError if the actual {@code Multimap} does not contain one or more of the specified entries. + */ @SafeVarargs public final SELF contains(Map.Entry... entries) { MutableList> pairs = Lists.mutable.of(entries).collect(Tuples::pairFrom); From c66a53f987e24609079ea9e44ce61dda80e8f501 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 09:21:48 -0500 Subject: [PATCH 05/39] Add isNullOrEmpty contract --- .../api/multimap/AbstractMultimapAssert.java | 37 ++++++++++++-- ...MultimapAssert_IsNullOrEmpty_Contract.java | 48 +++++++++++++++++++ .../BagMultimapAssert_IsNullOrEmpty_Test.java | 37 ++++++++++++++ ...ListMultimapAssert_IsNullOrEmpty_Test.java | 36 ++++++++++++++ .../SetMultimapAssert_IsNullOrEmpty_Test.java | 37 ++++++++++++++ 5 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index b1200f3..cb72ec4 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -1,5 +1,6 @@ package org.assertj.eclipse.collections.api.multimap; +import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty; import static org.assertj.core.error.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; @@ -13,7 +14,7 @@ import org.eclipse.collections.impl.tuple.Tuples; /** - * Base class for all implementations of assertions for {@link Multimap}s. + * Base class for all implementations of assertions for {@link Multimap}. * * @param the "self" type of this assertion class. * @param the type of the "actual" value. @@ -43,7 +44,7 @@ protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { * } * * @param entries the entries that are expected to be present in the {@link Multimap}. - * @return this assertion object. + * @return this assertion object for method chaining. * @throws AssertionError if the actual {@link Multimap} does not contain the given entries */ @SafeVarargs @@ -78,10 +79,12 @@ protected SELF containsForProxy(MutableList> entries) { /** * Verifies that the actual {@link Multimap} contains the given key-value entry. * - * @param key the key that is expected to be present in the {@link Multimap}. + * @param key the key that is expected to be present in the {@link Multimap}. * @param value the value that is expected to be associated with the given key in the {@link Multimap}. * @return this assertion object for method chaining. * @throws AssertionError if the actual {@link Multimap} does not contain the given key-value entry. + * @see #contains(Pair[]) + * @see #contains(Map.Entry[]) */ public SELF containsEntry(KEY key, VALUE value) { return this.contains(Tuples.pair(key, value)); @@ -102,7 +105,7 @@ public SELF containsEntry(KEY key, VALUE value) { * } * * @param keys the keys that are expected to be present in the {@link Multimap}. - * @return this assertion object. + * @return this assertion object for method chaining. * @throws AssertionError if the actual {@link Multimap} does not contain the given keys. */ public SELF containsKeys(KEY... keys) { @@ -113,4 +116,30 @@ public SELF containsKeys(KEY... keys) { } throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + + /** + * Verifies that the {@link Multimap} is null or empty. + *

+ * Example: + *

{@code
+   * // assertions that will pass
+   * Multimap multimap = null;
+   * assertThat(multimap).isNullOrEmpty();
+   *
+   * Multimap emptyMultimap = Multimaps.mutable.list.empty();
+   * assertThat(emptyMultimap).isNullOrEmpty();
+   *
+   * // assertion will fail
+   * Multimap multimapWithElements = Multimaps.mutable.list.with("Key", "Value");
+   * assertThat(multimapWithElements).isNullOrEmpty();
+   * }
+ * + * @throws AssertionError if the {@link Multimap} is either null or empty. + */ + public void isNullOrEmpty() { + if (this.actual == null || this.actual.isEmpty()) { + return; + } + throw this.assertionError(shouldBeNullOrEmpty(this.actual)); + } } diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java new file mode 100644 index 0000000..a2099be --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java @@ -0,0 +1,48 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_IsNullOrEmpty_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + default I nullInput() { + return null; + } + + @Test + default void passesEmptyMultimap() { + assertion(emptyInput()).isNullOrEmpty(); + } + + @Test + default void passesNullMultimap() { + assertion(nullInput()).isNullOrEmpty(); + } + + @Test + default void failsNotNullOrEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).isNullOrEmpty()) + .withMessageContaining("Expecting null or empty but was: " + testInput().toString()); + } + + @Test + default void softAssertionPassesEmpty() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, emptyInput()).isNullOrEmpty()); + } + + @Test + default void softAssertionPassesNullMultimap() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, nullInput()).isNullOrEmpty()); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java new file mode 100644 index 0000000..c03e700 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java new file mode 100644 index 0000000..1ef7c01 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java @@ -0,0 +1,36 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java new file mode 100644 index 0000000..c91d6c2 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } +} From 0c0a16679fd6ddb5ca0f041d5f1c05c76a11bf47 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 09:53:12 -0500 Subject: [PATCH 06/39] Add isNotEmpty contract --- .../api/multimap/AbstractMultimapAssert.java | 25 +++++++++++ ...actMultimapAssert_IsNotEmpty_Contract.java | 45 +++++++++++++++++++ .../BagMultimapAssert_IsNotEmpty_Test.java | 37 +++++++++++++++ .../ListMultimapAssert_IsNotEmpty_Test.java | 36 +++++++++++++++ .../SetMultimapAssert_IsNotEmpty_Test.java | 37 +++++++++++++++ 5 files changed, 180 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index cb72ec4..0fdf94a 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -3,6 +3,7 @@ import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty; import static org.assertj.core.error.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; +import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import java.util.Map; @@ -117,6 +118,30 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that the {@link Multimap} is not empty. + *

+ * Example: + *

{@code
+   * // assertion will pass
+   * Multimap multimap = Multimaps.mutable.list.with("Key", "Value");
+   * assertThat(multimap).isNotEmpty();
+   *
+   * // assertion will fail
+   * assertThat(Multimaps.mutable.list.empty()).isNotEmpty();
+   * }
+ * + * @return this assertion object for method chaining + * @throws AssertionError if the {@link Multimap} of values is empty. + */ + public SELF isNotEmpty() { + this.isNotNull(); + if (!this.actual.isEmpty()) { + return this.myself; + } + throw this.assertionError(shouldNotBeEmpty()); + } + /** * Verifies that the {@link Multimap} is null or empty. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java new file mode 100644 index 0000000..1a8b0eb --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java @@ -0,0 +1,45 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_IsNotEmpty_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + default I nullInput() { + return null; + } + + @Test + default void passesNotEmpty() { + assertion(testInput()).isNotEmpty(); + } + + @Test + default void failsEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).isNotEmpty()) + .withMessageContaining("Expecting actual not to be empty"); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).isNotEmpty()) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).isNotEmpty()); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java new file mode 100644 index 0000000..24b839b --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java new file mode 100644 index 0000000..563e893 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java @@ -0,0 +1,36 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java new file mode 100644 index 0000000..969f275 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } +} From 7ee978202116417cdb8bcf7f04e08e1c6526db56 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 10:12:03 -0500 Subject: [PATCH 07/39] Fix abstract class --- .../collections/api/multimap/AbstractMultimapAssert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 0fdf94a..45a90a0 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -22,7 +22,7 @@ * @param the type of keys in the Multimap. * @param the type of values in the Multimap. */ -public class AbstractMultimapAssert, ACTUAL extends Multimap, KEY, VALUE> +public abstract class AbstractMultimapAssert, ACTUAL extends Multimap, KEY, VALUE> extends AbstractObjectAssert { protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { From 93112c5936eacfb9190bf92bac0297a71757aafe Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 10:20:43 -0500 Subject: [PATCH 08/39] Add isEmpty assertion --- .../api/multimap/AbstractMultimapAssert.java | 23 ++++++++++ ...stractMultimapAssert_IsEmpty_Contract.java | 45 +++++++++++++++++++ .../bag/BagMultimapAssert_IsEmpty_Test.java | 37 +++++++++++++++ .../list/ListMultimapAssert_IsEmpty_Test.java | 36 +++++++++++++++ .../set/SetMultimapAssert_IsEmpty_Test.java | 37 +++++++++++++++ 5 files changed, 178 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 45a90a0..25e628d 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -1,5 +1,6 @@ package org.assertj.eclipse.collections.api.multimap; +import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty; import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty; import static org.assertj.core.error.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; @@ -118,6 +119,28 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that the {@link Multimap} is empty. + *

+ * Example: + *

{@code
+   * // assertion will pass
+   * assertThat(Multimaps.mutable.list.empty()).isEmpty();
+   *
+   * // assertion will fail
+   * Multimap multimap = Multimaps.mutable.list.with("Key", "Value");
+   * assertThat(multimap).isEmpty();
+   * }
+ * + * @throws AssertionError if the {@link Multimap} of values is not empty. + */ + public void isEmpty() { + this.isNotNull(); + if (!this.actual.isEmpty()) { + throw this.assertionError(shouldBeEmpty(this.actual)); + } + } + /** * Verifies that the {@link Multimap} is not empty. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java new file mode 100644 index 0000000..b930991 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java @@ -0,0 +1,45 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_IsEmpty_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + default I nullInput() { + return null; + } + + @Test + default void passes() { + assertion(emptyInput()).isEmpty(); + } + + @Test + default void failsNotEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).isEmpty()) + .withMessageContaining("Expecting empty but was: " + testInput().toString()); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).isEmpty()) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, emptyInput()).isEmpty()); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java new file mode 100644 index 0000000..5777928 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java new file mode 100644 index 0000000..ffeedf3 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java @@ -0,0 +1,36 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java new file mode 100644 index 0000000..0d42fbc --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java @@ -0,0 +1,37 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } +} From 50795f1ec5c2f601146d797d042cb428829331c2 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 10:21:15 -0500 Subject: [PATCH 09/39] Fix imports --- .../api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java | 1 - .../api/multimap/set/SetMultimapAssert_IsEmpty_Test.java | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java index 5777928..4e1234b 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java @@ -2,7 +2,6 @@ import org.assertj.eclipse.collections.api.SoftAssertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; import org.eclipse.collections.api.factory.Bags; import org.eclipse.collections.api.multimap.bag.BagMultimap; import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java index 0d42fbc..5b8a980 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java @@ -2,10 +2,9 @@ import org.assertj.eclipse.collections.api.SoftAssertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.SetMultimap; import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; import org.eclipse.collections.impl.factory.Multimaps; class SetMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, SetMultimapAssert> { From 8d487b3fd06db59b05c040066d1f74691ad3ac5b Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 11:12:54 -0500 Subject: [PATCH 10/39] Add hasValueSatisfying assertion --- .../api/multimap/AbstractMultimapAssert.java | 21 ++++++++ ...mapAssert_HasValueSatisfying_Contract.java | 50 +++++++++++++++++++ ...ultimapAssert_HasValueSatisfying_Test.java | 47 +++++++++++++++++ ...ultimapAssert_HasValueSatisfying_Test.java | 47 +++++++++++++++++ ...ultimapAssert_HasValueSatisfying_Test.java | 47 +++++++++++++++++ 5 files changed, 212 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 25e628d..42872cd 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -1,14 +1,17 @@ package org.assertj.eclipse.collections.api.multimap; +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.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; +import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import java.util.Map; import org.assertj.core.api.AbstractObjectAssert; +import org.assertj.core.api.Condition; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.multimap.Multimap; @@ -119,6 +122,24 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that at least one value in the actual {@link Multimap} satisfies the given condition. + * + * @param valueCondition the condition to evaluate the values against; must not be null. + * @return this assertion object for method chaining. + * @throws NullPointerException if the provided condition is null. + * @throws AssertionError if none of the values in the {@link Multimap} satisfy the given condition. + */ + public SELF hasValueSatisfying(Condition valueCondition) { + this.isNotNull(); + requireNonNull(valueCondition, "The condition to evaluate should not be null"); + + if (this.actual.valuesView().anySatisfy(valueCondition::matches)) { + return this.myself; + } + throw this.assertionError(shouldContainValue(this.actual, valueCondition)); + } + /** * Verifies that the {@link Multimap} is empty. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java new file mode 100644 index 0000000..8386aa5 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasValueSatisfying_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + Condition passingCondition(); + + Condition failingCondition(); + + default I nullInput() { + return null; + } + + @Test + default void passesValueSatisfying() { + assertion(testInput()).hasValueSatisfying(passingCondition()); + } + + @Test + default void failsValueNotSatisfying() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasValueSatisfying(failingCondition())) + .withMessageContaining(failingCondition().description().toString()); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasValueSatisfying(passingCondition())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasValueSatisfying(passingCondition())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java new file mode 100644 index 0000000..2f33b8a --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java new file mode 100644 index 0000000..d2dad9f --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java new file mode 100644 index 0000000..18ae767 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); + } +} From 2d27a398955c01c4bcd141346f6a3b4895729ea0 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 11:57:25 -0500 Subject: [PATCH 11/39] Add hasSizeLessThanOrEqualTo assertion --- .../api/multimap/AbstractMultimapAssert.java | 32 ++++++++++- ...ert_HasSizeLessThanOrEqualTo_Contract.java | 57 +++++++++++++++++++ ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 51 +++++++++++++++++ ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 51 +++++++++++++++++ ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 51 +++++++++++++++++ 5 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 42872cd..12a34be 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -6,6 +6,7 @@ import static org.assertj.core.error.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; +import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import java.util.Map; @@ -122,13 +123,42 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than or equal to the boundary. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key2", "Value2");
+   *
+   * // assertion will pass
+   * assertThat(multimap).hasSizeLessThanOrEqualTo(2)
+   *                     .hasSizeLessThanOrEqualTo(3);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSizeLessThanOrEqualTo(0);
+   * assertThat(multimap).hasSizeLessThanOrEqualTo(1);
+   * }
+ * + * @param boundary the maximum expected size of the {@link Multimap}. + * @return {@code this} assertion object for method chaining. + * @throws AssertionError if the actual size of the {@link Multimap} is greater than the expected size. + */ + public SELF hasSizeLessThanOrEqualTo(int boundary) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize <= boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveSizeLessThanOrEqualTo(this.actual, actualSize, boundary)); + } + /** * Verifies that at least one value in the actual {@link Multimap} satisfies the given condition. * * @param valueCondition the condition to evaluate the values against; must not be null. * @return this assertion object for method chaining. * @throws NullPointerException if the provided condition is null. - * @throws AssertionError if none of the values in the {@link Multimap} satisfy the given condition. + * @throws AssertionError if none of the values in the {@link Multimap} satisfy the given condition. */ public SELF hasValueSatisfying(Condition valueCondition) { this.isNotNull(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java new file mode 100644 index 0000000..9c33f5e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java @@ -0,0 +1,57 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + default I nullInput() { + return null; + } + + @Test + default void passesLessThan() { + assertion(testInput()).hasSizeLessThanOrEqualTo(upperBoundary()); + } + + @Test + default void passesEqual() { + assertion(testInput()).hasSizeLessThanOrEqualTo(equalsBoundary()); + } + + @Test + default void failsGreater() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeLessThanOrEqualTo(lowerBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than or equal to %s but was %s", lowerBoundary(), testInput().size())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasSizeLessThanOrEqualTo(upperBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeLessThanOrEqualTo(upperBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java new file mode 100644 index 0000000..ae76b0d --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java new file mode 100644 index 0000000..bf5f83d --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java new file mode 100644 index 0000000..1a5a85c --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} From f785eae5af3f97f192e0536926ad3a63487fdafe Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 13:48:25 -0500 Subject: [PATCH 12/39] Add hasKeySatisfying assertion --- .../api/multimap/AbstractMultimapAssert.java | 20 ++++++++ ...timapAssert_HasKeySatisfying_Contract.java | 50 +++++++++++++++++++ ...gMultimapAssert_HasKeySatisfying_Test.java | 47 +++++++++++++++++ ...tMultimapAssert_HasKeySatisfying_Test.java | 47 +++++++++++++++++ ...tMultimapAssert_HasKeySatisfying_Test.java | 47 +++++++++++++++++ 5 files changed, 211 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 12a34be..1ee2bb1 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -4,6 +4,7 @@ import static org.assertj.core.error.ShouldBeEmpty.shouldBeEmpty; import static org.assertj.core.error.ShouldBeNullOrEmpty.shouldBeNullOrEmpty; import static org.assertj.core.error.ShouldContain.shouldContain; +import static org.assertj.core.error.ShouldContainKey.shouldContainKey; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; @@ -123,6 +124,25 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that at least one key in the actual {@link Multimap} satisfies the given condition. + * + * @param keyCondition the condition to evaluate the keys against; must not be null. + * @return this assertion object for method chaining. + * @throws NullPointerException if the provided condition is null. + * @throws AssertionError if none of the keys in the {@link Multimap} satisfy the given condition. + */ + public SELF hasKeySatisfying(Condition keyCondition) { + this.isNotNull(); + requireNonNull(keyCondition, "The condition to evaluate should not be null"); + + if (this.actual.keysView().anySatisfy(keyCondition::matches)) { + return this.myself; + } + + throw this.assertionError(shouldContainKey(this.actual, keyCondition)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than or equal to the boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java new file mode 100644 index 0000000..d4c08aa --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasKeySatisfying_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + Condition passingCondition(); + + Condition failingCondition(); + + default I nullInput() { + return null; + } + + @Test + default void passesValueSatisfying() { + assertion(testInput()).hasKeySatisfying(passingCondition()); + } + + @Test + default void failsValueNotSatisfying() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasKeySatisfying(failingCondition())) + .withMessageContaining(failingCondition().description().toString()); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasKeySatisfying(passingCondition())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasKeySatisfying(passingCondition())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java new file mode 100644 index 0000000..3c458b7 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java new file mode 100644 index 0000000..a98532b --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java new file mode 100644 index 0000000..e61f072 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java @@ -0,0 +1,47 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public Condition passingCondition() { + return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); + } + + @Override + public Condition failingCondition() { + return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); + } +} From ffb7affb85ad12cd39b5488a53c9ca54f83ba9a3 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 14:01:25 -0500 Subject: [PATCH 13/39] Add hasDistinctSize assertion --- .../api/multimap/AbstractMultimapAssert.java | 17 +++++++ .../error/ShouldHaveDistinctSize.java | 27 ++++++++++ .../collections/error/package-info.java | 1 + ...ltimapAssert_HasDistinctSize_Contract.java | 50 +++++++++++++++++++ ...agMultimapAssert_HasDistinctSize_Test.java | 41 +++++++++++++++ ...stMultimapAssert_HasDistinctSize_Test.java | 41 +++++++++++++++ ...etMultimapAssert_HasDistinctSize_Test.java | 43 ++++++++++++++++ 7 files changed, 220 insertions(+) create mode 100644 src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java create mode 100644 src/main/java/org/assertj/eclipse/collections/error/package-info.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 1ee2bb1..e94ff04 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -9,6 +9,7 @@ import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; +import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSize.shouldHaveDistinctSize; import java.util.Map; @@ -124,6 +125,22 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that the actual {@code Multimap} has the expected number of distinct keys. + * + * @param expected the expected number of distinct keys in the {@code Multimap}. + * @return this assertion object for method chaining. + * @throws AssertionError if the actual number of distinct keys in the {@code Multimap} does not match the expected size. + */ + public SELF hasDistinctSize(int expected) { + this.isNotNull(); + int actualSize = this.actual.sizeDistinct(); + if (actualSize == expected) { + return this.myself; + } + throw this.assertionError(shouldHaveDistinctSize(this.actual, actualSize, expected)); + } + /** * Verifies that at least one key in the actual {@link Multimap} satisfies the given condition. * diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java new file mode 100644 index 0000000..59bce8c --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java @@ -0,0 +1,27 @@ +package org.assertj.eclipse.collections.error; + +import org.assertj.core.error.BasicErrorMessageFactory; +import org.assertj.core.error.ErrorMessageFactory; + +import static java.lang.String.format; + +/** + * Creates an error message indicating that an assertion that verifies that a value have certain distinct size failed. + */ +public class ShouldHaveDistinctSize extends BasicErrorMessageFactory { + /** + * Creates a new {@code ShouldHaveDistinctSize}. + * + * @param actual the actual value in the failed assertion. + * @param actualSize the distinct size of {@code actual}. + * @param expectedSize the expected size. + * @return the created {@code ErrorMessageFactory}. + */ + public static ErrorMessageFactory shouldHaveDistinctSize(Object actual, int actualSize, int expectedSize) { + return new ShouldHaveDistinctSize(actual, actualSize, expectedSize); + } + + private ShouldHaveDistinctSize(Object actual, int actualSize, int expectedSize) { + super(format("%nExpected distinct size: %s but was: %s in:%n%s", expectedSize, actualSize, "%s"), actual); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/error/package-info.java b/src/main/java/org/assertj/eclipse/collections/error/package-info.java new file mode 100644 index 0000000..0252be4 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/error/package-info.java @@ -0,0 +1 @@ +package org.assertj.eclipse.collections.error; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java new file mode 100644 index 0000000..2521da1 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasDistinctSize_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testData); + + A softAssertion(SoftAssertions softAssertions, I testData); + + int expectedSize(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passes() { + this.assertion(this.testInput()).hasDistinctSize(this.expectedSize()); + } + + @Test + default void failsEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> this.assertion(this.emptyInput()).hasDistinctSize(this.expectedSize())) + .withMessageContaining(String.format("Expected distinct size: %s but was: 0", this.expectedSize())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> this.assertion(this.nullInput()).hasDistinctSize(this.expectedSize())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()).hasDistinctSize(this.expectedSize())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java new file mode 100644 index 0000000..6136878 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java @@ -0,0 +1,41 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testData) { + return BagMultimapAssert.assertThat(testData); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testData) { + return softAssertions.assertThat(testData); + } + + @Override + public int expectedSize() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java new file mode 100644 index 0000000..f53f01e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java @@ -0,0 +1,41 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testData) { + return ListMultimapAssert.assertThat(testData); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testData) { + return softAssertions.assertThat(testData); + } + + @Override + public int expectedSize() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java new file mode 100644 index 0000000..1f367c7 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java @@ -0,0 +1,43 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testData) { + return SetMultimapAssert.assertThat(testData); + } + + @Override + public SetMultimapAssert softAssertion( + SoftAssertions softAssertions, + SetMultimap testData) { + return softAssertions.assertThat(testData); + } + + @Override + public int expectedSize() { + return 5; + } +} From 87f7871a088f01154e5570ae0ddb11e6c62fc860 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 14:48:31 -0500 Subject: [PATCH 14/39] Add hasSize assertion --- .../api/multimap/AbstractMultimapAssert.java | 29 +++++++++++ ...stractMultimapAssert_HasSize_Contract.java | 50 +++++++++++++++++++ .../bag/BagMultimapAssert_HasSize_Test.java | 41 +++++++++++++++ .../list/ListMultimapAssert_HasSize_Test.java | 41 +++++++++++++++ .../set/SetMultimapAssert_HasSize_Test.java | 42 ++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index e94ff04..be2bbb2 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -7,6 +7,7 @@ import static org.assertj.core.error.ShouldContainKey.shouldContainKey; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; +import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSize.shouldHaveDistinctSize; @@ -160,6 +161,34 @@ public SELF hasKeySatisfying(Condition keyCondition) { throw this.assertionError(shouldContainKey(this.actual, keyCondition)); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is equal to the given one. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key", "Value1", "Key", "Value2");
+   *
+   * // assertion will pass
+   * assertThat(multimap).hasSize(2);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSize(0);
+   * assertThat(multimap).hasSize(1);
+   * }
+ * + * @param expected the expected size of the {@link Multimap}. + * @return {@code this} assertion object. + * @throws AssertionError if the actual size of the {@link Multimap} is not equal to the expected size. + */ + public SELF hasSize(int expected) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize == expected) { + return this.myself; + } + throw this.assertionError(shouldHaveSize(this.actual, actualSize, expected)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than or equal to the boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java new file mode 100644 index 0000000..71e7101 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java @@ -0,0 +1,50 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasSize_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + int expectedSize(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passes() { + this.assertion(this.testInput()).hasSize(this.expectedSize()); + } + + @Test + default void failsEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> this.assertion(this.emptyInput()).hasSize(this.expectedSize())) + .withMessageContaining(String.format("Expected size: %s but was: 0", this.expectedSize())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> this.assertion(this.nullInput()).hasSize(this.expectedSize())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()).hasSize(this.expectedSize())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java new file mode 100644 index 0000000..361dcfd --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java @@ -0,0 +1,41 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int expectedSize() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java new file mode 100644 index 0000000..ab634b2 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java @@ -0,0 +1,41 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int expectedSize() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java new file mode 100644 index 0000000..3e51f74 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java @@ -0,0 +1,42 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, SetMultimapAssert> { + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int expectedSize() { + return 38; + } +} From 7046be660d45a6d46e43087974ff7d896c5759d2 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sat, 8 Feb 2025 23:13:24 -0500 Subject: [PATCH 15/39] Add hasSizeLessThan assertion --- .../api/multimap/AbstractMultimapAssert.java | 29 +++++++++ ...ltimapAssert_HasSizeLessThan_Contract.java | 60 +++++++++++++++++++ ...agMultimapAssert_HasSizeLessThan_Test.java | 51 ++++++++++++++++ ...stMultimapAssert_HasSizeLessThan_Test.java | 52 ++++++++++++++++ ...etMultimapAssert_HasSizeLessThan_Test.java | 51 ++++++++++++++++ 5 files changed, 243 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index be2bbb2..a819ff1 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -8,6 +8,7 @@ import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; +import static org.assertj.core.error.ShouldHaveSizeLessThan.shouldHaveSizeLessThan; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSize.shouldHaveDistinctSize; @@ -189,6 +190,34 @@ public SELF hasSize(int expected) { throw this.assertionError(shouldHaveSize(this.actual, actualSize, expected)); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than the boundary. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key2", "Value2");
+   *
+   * // assertion will pass
+   * assertThat(multimap).hasSizeLessThan(3);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSizeLessThan(1);
+   * assertThat(multimap).hasSizeLessThan(2);
+   * }
+ * + * @param boundary the maximum size (exclusive) the {@link Multimap} should have. + * @return {@code this} assertion object. + * @throws AssertionError if the actual size of the {@link Multimap} is not less than the expected size. + */ + public SELF hasSizeLessThan(int boundary) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize < boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveSizeLessThan(this.actual, actualSize, boundary)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than or equal to the boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java new file mode 100644 index 0000000..c3262bb --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java @@ -0,0 +1,60 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasSizeLessThan_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + default I nullInput() { + return null; + } + + @Test + default void passesLessThan() { + assertion(testInput()).hasSizeLessThan(upperBoundary()); + } + + @Test + default void failsGreater() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeLessThan(lowerBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than %s but was %s", lowerBoundary(), testInput().size())); + } + + @Test + default void failsEquals() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeLessThan(equalsBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than %s but was %s", equalsBoundary(), testInput().size())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasSizeLessThan(upperBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeLessThan(upperBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java new file mode 100644 index 0000000..31a7d1c --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class BagMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java new file mode 100644 index 0000000..d821055 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java @@ -0,0 +1,52 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class ListMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java new file mode 100644 index 0000000..2cc7a9e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +class SetMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} From 9443a77de9d53845dce30451e0c6431ae5b8e710 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 09:49:50 -0500 Subject: [PATCH 16/39] Add containsOnly assertion --- .../api/multimap/AbstractMultimapAssert.java | 49 +++++++ ...tMultimapAssert_ContainsOnly_Contract.java | 121 ++++++++++++++++++ .../BagMultimapAssert_ContainsOnly_Test.java | 100 +++++++++++++++ .../ListMultimapAssert_ContainsOnly_Test.java | 100 +++++++++++++++ .../SetMultimapAssert_ContainsOnly_Test.java | 100 +++++++++++++++ 5 files changed, 470 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index a819ff1..5cb145d 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -6,6 +6,7 @@ import static org.assertj.core.error.ShouldContain.shouldContain; import static org.assertj.core.error.ShouldContainKey.shouldContainKey; import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; +import static org.assertj.core.error.ShouldContainOnly.shouldContainOnly; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; import static org.assertj.core.error.ShouldHaveSizeLessThan.shouldHaveSizeLessThan; @@ -17,10 +18,14 @@ import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.Condition; +import org.assertj.core.error.GroupTypeDescription; +import org.eclipse.collections.api.RichIterable; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.partition.list.PartitionMutableList; import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.list.fixed.ArrayAdapter; import org.eclipse.collections.impl.tuple.Tuples; /** @@ -127,6 +132,50 @@ public SELF containsKeys(KEY... keys) { throw this.assertionError(shouldContainKeys(this.actual, keysNotFound.toSet())); } + /** + * Verifies that the map contains only the given entries. + * + * @param entries the array of map entries to validate against the map + * @return this assertion object for method chaining + * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. + */ + @SafeVarargs + public final SELF containsOnly(Map.Entry... entries) { + @SuppressWarnings("unchecked") + Pair[] pairs = ArrayAdapter.adapt(entries).collect(Tuples::pairFrom).toArray(new Pair[entries.length]); + return this.containsOnlyForProxy(pairs); + } + + /** + * Verifies that the current object contains only the specified pairs of key-value entries. + * + * @param entries the pairs of key-value entries to check against + * @return this assertion object for method chaining + * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. + */ + @SafeVarargs + public final SELF containsOnly(Pair... entries) { + return this.containsOnlyForProxy(entries); + } + + protected SELF containsOnlyForProxy(Pair[] entries) { + this.isNotNull(); + PartitionMutableList> partition = ArrayAdapter + .adapt(entries) + .partition(entry -> this.actual.containsKeyAndValue(entry.getOne(), entry.getTwo())); + + MutableList> found = partition.getSelected(); + MutableList> notFound = partition.getRejected(); + RichIterable> notExpected = this.actual.keyValuePairsView().reject(found::contains); + + if (notFound.isEmpty() && notExpected.isEmpty()) { + return this.myself; + } + + GroupTypeDescription groupTypeDescription = new GroupTypeDescription("multimap", "multimap entries"); + throw this.assertionError(shouldContainOnly(this.actual, entries, notFound, notExpected, groupTypeDescription)); + } + /** * Verifies that the actual {@code Multimap} has the expected number of distinct keys. * diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java new file mode 100644 index 0000000..215a4c4 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java @@ -0,0 +1,121 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_ContainsOnly_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + Pair[] exactMatchPairs(); + + Map.Entry[] exactMatchEntries(); + + Pair[] partialMatchMissingPairs(); + + Map.Entry[] partialMatchMissingEntries(); + + Pair[] partialMatchExtraPairs(); + + Map.Entry[] partialMatchExtraEntries(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passesWithPairs() { + assertion(testInput()).containsOnly(exactMatchPairs()); + } + + @Test + default void passesWithEntries() { + assertion(testInput()).containsOnly(exactMatchEntries()); + } + + @Test + default void failsWhenAdditionalKeysOrValuesExistWithPair() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchMissingPairs())) + .withMessageContaining("to contain only") + .withMessageContaining("but the following multimap entries were unexpected"); + } + + @Test + default void failsWhenAdditionalKeysOrValuesExistWithEntry() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchMissingEntries())) + .withMessageContaining("to contain only") + .withMessageContaining("but the following multimap entries were unexpected"); + } + + @Test + default void failsWhenEntryIsMissingWithPair() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchExtraPairs())) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @Test + default void failsWhenEntryIsMissingWithEntry() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchExtraEntries())) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @Test + default void failsForEmptyMultimapWithPair() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).containsOnly(exactMatchPairs())) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @Test + default void failsForEmptyMultimapWithEntry() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).containsOnly(exactMatchEntries())) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @Test + default void failsForNullMultimapWithPair() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).containsOnly(exactMatchPairs())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsForNullMultimapWithEntry() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).containsOnly(exactMatchEntries())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPassesWithPairs() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsOnly(exactMatchPairs())); + } + + @Test + default void softAssertionPassesWithEntries() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsOnly(exactMatchEntries())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java new file mode 100644 index 0000000..bccea61 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java @@ -0,0 +1,100 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, BagMultimapAssert> { + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] exactMatchPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] exactMatchEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchMissingPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchMissingEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchExtraPairs() { + return new Pair[]{ + pair("TOS", "Enterprise"), + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchExtraEntries() { + return new Map.Entry[]{ + pair("TOS", "Enterprise").toEntry(), + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java new file mode 100644 index 0000000..ba288f0 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java @@ -0,0 +1,100 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, ListMultimapAssert> { + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] exactMatchPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] exactMatchEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchMissingPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchMissingEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchExtraPairs() { + return new Pair[]{ + pair("TOS", "Enterprise"), + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchExtraEntries() { + return new Map.Entry[]{ + pair("TOS", "Enterprise").toEntry(), + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java new file mode 100644 index 0000000..72d289d --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java @@ -0,0 +1,100 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, SetMultimapAssert> { + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Pair[] exactMatchPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] exactMatchEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchMissingPairs() { + return new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchMissingEntries() { + return new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } + + @Override + public Pair[] partialMatchExtraPairs() { + return new Pair[]{ + pair("TOS", "Enterprise"), + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + } + + @Override + public Map.Entry[] partialMatchExtraEntries() { + return new Map.Entry[]{ + pair("TOS", "Enterprise").toEntry(), + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + } +} From 908f2e3f0787d25bd8632694ac5daac234972be8 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 10:58:42 -0500 Subject: [PATCH 17/39] Add hasSizeGreaterThan assertion --- .../api/multimap/AbstractMultimapAssert.java | 29 ++++++++ ...mapAssert_HasSizeGreaterThan_Contract.java | 70 +++++++++++++++++++ ...ultimapAssert_HasSizeGreaterThan_Test.java | 51 ++++++++++++++ ...ultimapAssert_HasSizeGreaterThan_Test.java | 51 ++++++++++++++ ...ultimapAssert_HasSizeGreaterThan_Test.java | 51 ++++++++++++++ 5 files changed, 252 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 5cb145d..a017abe 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -9,6 +9,7 @@ import static org.assertj.core.error.ShouldContainOnly.shouldContainOnly; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; +import static org.assertj.core.error.ShouldHaveSizeGreaterThan.shouldHaveSizeGreaterThan; import static org.assertj.core.error.ShouldHaveSizeLessThan.shouldHaveSizeLessThan; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; @@ -239,6 +240,34 @@ public SELF hasSize(int expected) { throw this.assertionError(shouldHaveSize(this.actual, actualSize, expected)); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is greater than the specified boundary. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key1", "Value2", "Key2", "Value3");
+   *
+   * // assertion will pass
+   * assertThat(multimap).hasSizeGreaterThan(1);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSizeGreaterThan(3);
+   * assertThat(multimap).hasSizeGreaterThan(4);
+   * }
+ * + * @param boundary the size that the actual number of key-value pairs should exceed. + * @return {@code this} assertion object. + * @throws AssertionError if the actual size of the {@link Multimap} is not greater than the specified boundary. + */ + public SELF hasSizeGreaterThan(int boundary) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize > boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveSizeGreaterThan(this.actual, actualSize, boundary)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than the boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java new file mode 100644 index 0000000..17bae4c --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java @@ -0,0 +1,70 @@ +package org.assertj.eclipse.collections.api.multimap; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +public interface AbstractMultimapAssert_HasSizeGreaterThan_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passesGreaterThan() { + assertion(testInput()).hasSizeGreaterThan(lowerBoundary()); + } + + @Test + default void failsLesser() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThan(upperBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary(), testInput().size())); + } + + @Test + default void failsEquals() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThan(equalsBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary(), testInput().size())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasSizeGreaterThan(upperBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsEmptyMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThan(upperBoundary())) + .withMessageContaining(String.format("to be greater than %s but was 0", upperBoundary())); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeGreaterThan(lowerBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java new file mode 100644 index 0000000..a5d1f04 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java new file mode 100644 index 0000000..7e71c98 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java new file mode 100644 index 0000000..922ae5d --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} From 686b43c2b4a76ed186d8d8ba54eed26602f3d73c Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 11:02:30 -0500 Subject: [PATCH 18/39] Tweak condition --- .../AbstractMultimapAssert_HasSizeGreaterThan_Contract.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java index 17bae4c..ec4a531 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java @@ -59,8 +59,8 @@ default void failsNullMultimap() { @Test default void failsEmptyMultimap() { assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThan(upperBoundary())) - .withMessageContaining(String.format("to be greater than %s but was 0", upperBoundary())); + .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThan(lowerBoundary())) + .withMessageContaining(String.format("to be greater than %s but was 0", lowerBoundary())); } @Test From 8f9404a65b81f1685f0242b4a2826ad063f333fc Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 11:19:01 -0500 Subject: [PATCH 19/39] Add README --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1cf7697 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# AssertJ Eclipse Collections + +[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) From 8429c53ad26025d59bd6e3d5993a6c080cec5851 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 14:11:25 -0500 Subject: [PATCH 20/39] Add hasSizeGreaterThanOrEqualTo assertion --- .../api/multimap/AbstractMultimapAssert.java | 31 +++++++++ ..._HasSizeGreaterThanOrEqualTo_Contract.java | 64 +++++++++++++++++++ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 51 +++++++++++++++ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 51 +++++++++++++++ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 51 +++++++++++++++ 5 files changed, 248 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index a017abe..3491890 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -10,6 +10,7 @@ import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; import static org.assertj.core.error.ShouldHaveSizeGreaterThan.shouldHaveSizeGreaterThan; +import static org.assertj.core.error.ShouldHaveSizeGreaterThanOrEqualTo.shouldHaveSizeGreaterThanOrEqualTo; import static org.assertj.core.error.ShouldHaveSizeLessThan.shouldHaveSizeLessThan; import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; @@ -268,6 +269,36 @@ public SELF hasSizeGreaterThan(int boundary) { throw this.assertionError(shouldHaveSizeGreaterThan(this.actual, actualSize, boundary)); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is greater than or equal to the + * boundary. + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key2", "Value2");
+   *
+   * // assertions will pass
+   * assertThat(multimap).hasSizeGreaterThanOrEqualTo(1)
+   *                     .hasSizeGreaterThanOrEqualTo(2);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSizeGreaterThanOrEqualTo(3);
+   * assertThat(multimap).hasSizeGreaterThanOrEqualTo(5);
+   * }
+ * + * @param boundary the minimum size (inclusive) the {@link Multimap} should have. + * @return {@code this} assertion object for method chaining. + * @throws AssertionError if the actual size of the {@link Multimap} is less than the expected size. + */ + public SELF hasSizeGreaterThanOrEqualTo(int boundary) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize >= boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveSizeGreaterThanOrEqualTo(this.actual, actualSize, boundary)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is less than the boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java new file mode 100644 index 0000000..76e0d6b --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java @@ -0,0 +1,64 @@ +package org.assertj.eclipse.collections.api.multimap; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +public interface AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + default I nullInput() { + return null; + } + + @Test + default void passesGreaterThan() { + assertion(testInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary()); + } + + @Test + default void passesEqual() { + assertion(testInput()).hasSizeGreaterThanOrEqualTo(equalsBoundary()); + } + + @Test + default void failsLessThan() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThanOrEqualTo(upperBoundary())) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be greater than or equal to %s but was %s", upperBoundary(), testInput().size())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsEmptyMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())) + .withMessageContaining(String.format("to be greater than or equal to %s but was 0", lowerBoundary())); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..f23ae63 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat( testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..e5cedc8 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat( testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..a3ca65d --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat( testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public int upperBoundary() { + return 50; + } + + @Override + public int lowerBoundary() { + return 5; + } + + @Override + public int equalsBoundary() { + return 38; + } +} From 292c93f406d74f76db2e0fd46e5bc9c9affec1ff Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 14:24:16 -0500 Subject: [PATCH 21/39] Add containsValues assertion --- .../api/multimap/AbstractMultimapAssert.java | 17 +++++ ...ultimapAssert_ContainsValues_Contract.java | 63 +++++++++++++++++++ ...BagMultimapAssert_ContainsValues_Test.java | 46 ++++++++++++++ ...istMultimapAssert_ContainsValues_Test.java | 46 ++++++++++++++ ...SetMultimapAssert_ContainsValues_Test.java | 46 ++++++++++++++ 5 files changed, 218 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 3491890..627be7e 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -8,6 +8,7 @@ import static org.assertj.core.error.ShouldContainKeys.shouldContainKeys; import static org.assertj.core.error.ShouldContainOnly.shouldContainOnly; import static org.assertj.core.error.ShouldContainValue.shouldContainValue; +import static org.assertj.core.error.ShouldContainValues.shouldContainValues; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; import static org.assertj.core.error.ShouldHaveSizeGreaterThan.shouldHaveSizeGreaterThan; import static org.assertj.core.error.ShouldHaveSizeGreaterThanOrEqualTo.shouldHaveSizeGreaterThanOrEqualTo; @@ -178,6 +179,22 @@ protected SELF containsOnlyForProxy(Pair[] entri throw this.assertionError(shouldContainOnly(this.actual, entries, notFound, notExpected, groupTypeDescription)); } + /** + * Verifies that the actual map contains the given values. + * + * @param values the values expected to be present in the actual map + * @return the current assertion object for method chaining + * @throws AssertionError if the actual map does not contain the given values + */ + public SELF containsValues(VALUE... values) { + this.isNotNull(); + MutableList valuesNotFound = ArrayAdapter.adapt(values).reject(this.actual::containsValue); + if (valuesNotFound.isEmpty()) { + return this.myself; + } + throw this.assertionError(shouldContainValues(this.actual, valuesNotFound.toSet())); + } + /** * Verifies that the actual {@code Multimap} has the expected number of distinct keys. * diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java new file mode 100644 index 0000000..29bb6c0 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java @@ -0,0 +1,63 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_ContainsValues_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + VALUE[] expectedValues(); + + VALUE missingValue(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passes() { + assertion(testInput()).containsValues(expectedValues()); + } + + @Test + default void failsEmpty() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).containsValues(expectedValues())) + .withMessageContaining("Expecting actual") + .withMessageContaining("{}") + .withMessageContaining("to contain values"); + } + + @Test + default void failsMissingKey() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).containsValues(missingValue())) + .withMessageContaining("Expecting actual") + .withMessageContaining("to contain value") + .withMessageContaining(missingValue().toString()); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).containsValues(expectedValues())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsValues(expectedValues())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java new file mode 100644 index 0000000..60f5328 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedValues() { + return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; + } + + @Override + public String missingValue() { + return "Kes"; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java new file mode 100644 index 0000000..19f3cd5 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedValues() { + return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; + } + + @Override + public String missingValue() { + return "Kes"; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java new file mode 100644 index 0000000..ca26810 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java @@ -0,0 +1,46 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public String[] expectedValues() { + return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; + } + + @Override + public String missingValue() { + return "Kes"; + } +} From aab8f708297fe16fa242a6d65386efe91ea52548 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 14:53:38 -0500 Subject: [PATCH 22/39] Add license headers --- .../assertj/eclipse/collections/api/Assertions.java | 12 ++++++++++++ .../EclipseCollectionsSoftAssertionsProvider.java | 12 ++++++++++++ .../eclipse/collections/api/SoftAssertions.java | 12 ++++++++++++ .../api/multimap/AbstractMultimapAssert.java | 12 ++++++++++++ .../api/multimap/bag/BagMultimapAssert.java | 12 ++++++++++++ .../collections/api/multimap/bag/package-info.java | 12 ++++++++++++ .../api/multimap/list/ListMultimapAssert.java | 12 ++++++++++++ .../collections/api/multimap/list/package-info.java | 12 ++++++++++++ .../collections/api/multimap/package-info.java | 12 ++++++++++++ .../api/multimap/set/SetMultimapAssert.java | 12 ++++++++++++ .../collections/api/multimap/set/package-info.java | 12 ++++++++++++ .../eclipse/collections/api/package-info.java | 12 ++++++++++++ .../collections/error/ShouldHaveDistinctSize.java | 12 ++++++++++++ .../eclipse/collections/error/package-info.java | 12 ++++++++++++ ...bstractMultimapAssert_ContainsEntry_Contract.java | 12 ++++++++++++ ...AbstractMultimapAssert_ContainsKeys_Contract.java | 12 ++++++++++++ ...AbstractMultimapAssert_ContainsOnly_Contract.java | 12 ++++++++++++ ...stractMultimapAssert_ContainsValues_Contract.java | 12 ++++++++++++ .../AbstractMultimapAssert_Contains_Contract.java | 12 ++++++++++++ ...tractMultimapAssert_HasDistinctSize_Contract.java | 12 ++++++++++++ ...ractMultimapAssert_HasKeySatisfying_Contract.java | 12 ++++++++++++ ...pAssert_HasSizeGreaterThanOrEqualTo_Contract.java | 12 ++++++++++++ ...ctMultimapAssert_HasSizeGreaterThan_Contract.java | 12 ++++++++++++ ...imapAssert_HasSizeLessThanOrEqualTo_Contract.java | 12 ++++++++++++ ...tractMultimapAssert_HasSizeLessThan_Contract.java | 12 ++++++++++++ .../AbstractMultimapAssert_HasSize_Contract.java | 12 ++++++++++++ ...ctMultimapAssert_HasValueSatisfying_Contract.java | 12 ++++++++++++ .../AbstractMultimapAssert_IsEmpty_Contract.java | 12 ++++++++++++ .../AbstractMultimapAssert_IsNotEmpty_Contract.java | 12 ++++++++++++ ...bstractMultimapAssert_IsNullOrEmpty_Contract.java | 12 ++++++++++++ .../bag/BagMultimapAssert_ContainsEntry_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_ContainsKeys_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_ContainsOnly_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_ContainsValues_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_Contains_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_HasDistinctSize_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_HasKeySatisfying_Test.java | 12 ++++++++++++ ...timapAssert_HasSizeGreaterThanOrEqualTo_Test.java | 12 ++++++++++++ .../BagMultimapAssert_HasSizeGreaterThan_Test.java | 12 ++++++++++++ ...MultimapAssert_HasSizeLessThanOrEqualTo_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_HasSizeLessThan_Test.java | 12 ++++++++++++ .../multimap/bag/BagMultimapAssert_HasSize_Test.java | 12 ++++++++++++ .../BagMultimapAssert_HasValueSatisfying_Test.java | 12 ++++++++++++ .../multimap/bag/BagMultimapAssert_IsEmpty_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_IsNotEmpty_Test.java | 12 ++++++++++++ .../bag/BagMultimapAssert_IsNullOrEmpty_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_ContainsEntry_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_ContainsKeys_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_ContainsOnly_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_ContainsValues_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_Contains_Test.java | 12 ++++++++++++ .../ListMultimapAssert_HasDistinctSize_Test.java | 12 ++++++++++++ .../ListMultimapAssert_HasKeySatisfying_Test.java | 12 ++++++++++++ ...timapAssert_HasSizeGreaterThanOrEqualTo_Test.java | 12 ++++++++++++ .../ListMultimapAssert_HasSizeGreaterThan_Test.java | 12 ++++++++++++ ...MultimapAssert_HasSizeLessThanOrEqualTo_Test.java | 12 ++++++++++++ .../ListMultimapAssert_HasSizeLessThan_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_HasSize_Test.java | 12 ++++++++++++ .../ListMultimapAssert_HasValueSatisfying_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_IsEmpty_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_IsNotEmpty_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_IsNullOrEmpty_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_ContainsEntry_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_ContainsKeys_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_ContainsOnly_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_ContainsValues_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_Contains_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_HasDistinctSize_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_HasKeySatisfying_Test.java | 12 ++++++++++++ ...timapAssert_HasSizeGreaterThanOrEqualTo_Test.java | 12 ++++++++++++ .../SetMultimapAssert_HasSizeGreaterThan_Test.java | 12 ++++++++++++ ...MultimapAssert_HasSizeLessThanOrEqualTo_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_HasSizeLessThan_Test.java | 12 ++++++++++++ .../multimap/set/SetMultimapAssert_HasSize_Test.java | 12 ++++++++++++ .../SetMultimapAssert_HasValueSatisfying_Test.java | 12 ++++++++++++ .../multimap/set/SetMultimapAssert_IsEmpty_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_IsNotEmpty_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_IsNullOrEmpty_Test.java | 12 ++++++++++++ 78 files changed, 936 insertions(+) diff --git a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java index 07587fd..abab11f 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api; import org.assertj.core.util.CheckReturnValue; diff --git a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java index bca67d0..38cd6c6 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java +++ b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api; import org.assertj.core.api.SoftAssertionsProvider; diff --git a/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java index 60e0112..c8c527d 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api; import org.assertj.core.api.AbstractSoftAssertions; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 627be7e..bbb4263 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static java.util.Objects.requireNonNull; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java index 2b2f5b9..9d435ae 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java index bba55c8..07d7fd5 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java index 1d8bc79..6deb7d1 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java index 6dd57a4..6d9b279 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java index 1b47aeb..d91dab0 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java index a8d9cd8..0b53ae9 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java index 228a0f9..abee666 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; diff --git a/src/main/java/org/assertj/eclipse/collections/api/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/package-info.java index d8ac04a..50abe1f 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/api/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api; diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java index 59bce8c..52d1c73 100644 --- a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.error; import org.assertj.core.error.BasicErrorMessageFactory; diff --git a/src/main/java/org/assertj/eclipse/collections/error/package-info.java b/src/main/java/org/assertj/eclipse/collections/error/package-info.java index 0252be4..0049dbd 100644 --- a/src/main/java/org/assertj/eclipse/collections/error/package-info.java +++ b/src/main/java/org/assertj/eclipse/collections/error/package-info.java @@ -1 +1,13 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.error; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java index d259fb6..a979675 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java index 42f8d0a..04d8a0b 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java index 215a4c4..d8dcdc9 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java index 29bb6c0..94fdb43 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java index d9c938e..d14e5b7 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java index 2521da1..25b4ac5 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java index d4c08aa..72ad842 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java index 76e0d6b..3a07301 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java index ec4a531..4d8ff14 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java index 9c33f5e..2cf7cf0 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java index c3262bb..773200c 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java index 71e7101..ac01032 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java index 8386aa5..4e3a9d9 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java index b930991..2b11f9a 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java index 1a8b0eb..007c560 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java index a2099be..869e403 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java index 1a62e01..0675e87 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java index 56d6897..b9453a7 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java index bccea61..a59538e 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java index 60f5328..0056487 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java index 1c51703..c73ee7b 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java index 6136878..6d5bda8 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java index 3c458b7..d95fe8d 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java index f23ae63..b5bac3f 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java index a5d1f04..d469efd 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java index ae76b0d..afb8afb 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java index 31a7d1c..764a42a 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java index 361dcfd..bc37c78 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java index 2f33b8a..9663d39 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java index 4e1234b..7f59444 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java index 24b839b..f5b063f 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java index c03e700..5dd1f55 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java index 970f90c..8722c16 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java index 40ed369..3b4c8ff 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java index ba288f0..b994bff 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java index 19f3cd5..dfade62 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java index 76b11e1..9da9063 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java index f53f01e..20689c1 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java index a98532b..1f9c621 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java index e5cedc8..390ddb9 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java index 7e71c98..3ee8457 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java index bf5f83d..d56d8ed 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java index d821055..1ef2f62 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java index ab634b2..4293f89 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java index d2dad9f..fa4c5ae 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java index ffeedf3..b308767 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java index 563e893..8d259d6 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java index 1ef7c01..86f42d5 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java index b62ae03..28c442b 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java index 418af53..8c63512 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java index 72d289d..8e1211d 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java index ca26810..7620a42 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java index 07aa330..56c6d7b 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import static org.eclipse.collections.impl.tuple.Tuples.pair; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java index 1f367c7..2ef096c 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java index e61f072..d4b189e 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java index a3ca65d..1f0e557 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java index 922ae5d..0646579 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java index 1a5a85c..778e698 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java index 2cc7a9e..932215f 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java index 3e51f74..6782025 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java index 18ae767..2f640b2 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.core.api.Condition; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java index 5b8a980..256bae3 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java index 969f275..7b2026d 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java index c91d6c2..e4078d0 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; From 4d74387ac5b3c558672062db143fc159ab15cc51 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 16:09:18 -0500 Subject: [PATCH 23/39] Remove package-info for now. I'll figure out if needed later. --- .../collections/api/multimap/bag/package-info.java | 13 ------------- .../collections/api/multimap/list/package-info.java | 13 ------------- .../collections/api/multimap/package-info.java | 13 ------------- .../collections/api/multimap/set/package-info.java | 13 ------------- .../eclipse/collections/api/package-info.java | 13 ------------- .../eclipse/collections/error/package-info.java | 13 ------------- 6 files changed, 78 deletions(-) delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/package-info.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/error/package-info.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java deleted file mode 100644 index 07d7fd5..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java deleted file mode 100644 index 6d9b279..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java deleted file mode 100644 index d91dab0..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java deleted file mode 100644 index abee666..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; diff --git a/src/main/java/org/assertj/eclipse/collections/api/package-info.java b/src/main/java/org/assertj/eclipse/collections/api/package-info.java deleted file mode 100644 index 50abe1f..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api; diff --git a/src/main/java/org/assertj/eclipse/collections/error/package-info.java b/src/main/java/org/assertj/eclipse/collections/error/package-info.java deleted file mode 100644 index 0049dbd..0000000 --- a/src/main/java/org/assertj/eclipse/collections/error/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.error; From 73920278e15681bd6d20d1f309bd151d54e2e946 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 16:34:23 -0500 Subject: [PATCH 24/39] Use list factory method instead of array adapter --- .../collections/api/multimap/AbstractMultimapAssert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index bbb4263..e8d9b96 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -200,7 +200,7 @@ protected SELF containsOnlyForProxy(Pair[] entri */ public SELF containsValues(VALUE... values) { this.isNotNull(); - MutableList valuesNotFound = ArrayAdapter.adapt(values).reject(this.actual::containsValue); + MutableList valuesNotFound = Lists.mutable.of(values).reject(this.actual::containsValue); if (valuesNotFound.isEmpty()) { return this.myself; } From d41236d8ad7bce13b1aa3acd907f7ca45ec829fb Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 17:41:53 -0500 Subject: [PATCH 25/39] Add hasDistinctSizeGreaterThan assertion --- .../api/multimap/AbstractMultimapAssert.java | 17 +++++ .../ShouldHaveDistinctSizeGreaterThan.java | 20 ++++++ ...t_HasDistinctSizeGreaterThan_Contract.java | 70 +++++++++++++++++++ ...ssert_HasDistinctSizeGreaterThan_Test.java | 51 ++++++++++++++ ...ssert_HasDistinctSizeGreaterThan_Test.java | 51 ++++++++++++++ ...ssert_HasDistinctSizeGreaterThan_Test.java | 51 ++++++++++++++ 6 files changed, 260 insertions(+) create mode 100644 src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index e8d9b96..b7f039a 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -28,6 +28,7 @@ import static org.assertj.core.error.ShouldHaveSizeLessThanOrEqualTo.shouldHaveSizeLessThanOrEqualTo; import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSize.shouldHaveDistinctSize; +import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSizeGreaterThan.shouldHaveDistinctSizeGreaterThan; import java.util.Map; @@ -223,6 +224,22 @@ public SELF hasDistinctSize(int expected) { throw this.assertionError(shouldHaveDistinctSize(this.actual, actualSize, expected)); } + /** + * Verifies that the number of distinct keys in the {@link Multimap} is greater than the specified boundary. + * + * @param boundary the size that the actual number of distinct keys should exceed. + * @return {@code this} assertion object for method chaining. + * @throws AssertionError if the actual distinct size of the {@link Multimap} is not greater than the specified boundary. + */ + public SELF hasDistinctSizeGreaterThan(int boundary) { + this.isNotNull(); + int actualSize = this.actual.sizeDistinct(); + if (actualSize > boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveDistinctSizeGreaterThan(this.actual, actualSize, boundary)); + } + /** * Verifies that at least one key in the actual {@link Multimap} satisfies the given condition. * diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java new file mode 100644 index 0000000..c713de6 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java @@ -0,0 +1,20 @@ +package org.assertj.eclipse.collections.error; + +import org.assertj.core.error.BasicErrorMessageFactory; +import org.assertj.core.error.ErrorMessageFactory; + +import static java.lang.String.format; + +public class ShouldHaveDistinctSizeGreaterThan extends BasicErrorMessageFactory { + public static ErrorMessageFactory shouldHaveDistinctSizeGreaterThan(Object actual, int actualSize, int expectedMinSize) { + return new ShouldHaveDistinctSizeGreaterThan(actual, actualSize, expectedMinSize); + } + + private ShouldHaveDistinctSizeGreaterThan(Object actual, int actualSize, int expectedSize) { + super(format("%n" + + "Expecting distinct size of:%n" + + " %%s%n" + + "to be greater than %s but was %s", expectedSize, actualSize), + actual); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java new file mode 100644 index 0000000..308f69e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java @@ -0,0 +1,70 @@ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +public interface AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passesGreaterThan() { + assertion(testInput()).hasDistinctSizeGreaterThan(lowerBoundary()); + } + + @Test + default void failsLesser() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThan(upperBoundary())) + .withMessageContaining("Expecting distinct size of") + .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary(), testInput().sizeDistinct())); + } + + @Test + default void failsEquals() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThan(equalsBoundary())) + .withMessageContaining("Expecting distinct size of") + .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary(), testInput().sizeDistinct())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasDistinctSizeGreaterThan(lowerBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsEmptyMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).hasDistinctSizeGreaterThan(lowerBoundary())) + .withMessageContaining(String.format("to be greater than %s but was 0", lowerBoundary())); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasDistinctSizeGreaterThan(lowerBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java new file mode 100644 index 0000000..a366cd4 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java new file mode 100644 index 0000000..db6ba4f --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java new file mode 100644 index 0000000..4170476 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -0,0 +1,51 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} From bed1e36515e5d8579d09e78169fe281465c77cd5 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 17:44:02 -0500 Subject: [PATCH 26/39] Add license headers --- .../error/ShouldHaveDistinctSizeGreaterThan.java | 12 ++++++++++++ ...apAssert_HasDistinctSizeGreaterThan_Contract.java | 12 ++++++++++++ ...ltimapAssert_HasDistinctSizeGreaterThan_Test.java | 12 ++++++++++++ ...ltimapAssert_HasDistinctSizeGreaterThan_Test.java | 12 ++++++++++++ ...ltimapAssert_HasDistinctSizeGreaterThan_Test.java | 12 ++++++++++++ 5 files changed, 60 insertions(+) diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java index c713de6..5b51c3a 100644 --- a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.error; import org.assertj.core.error.BasicErrorMessageFactory; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java index 308f69e..6623c4c 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java index a366cd4..8bcf1bc 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java index db6ba4f..0d71150 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java index 4170476..fccc0f1 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; From 2aa7c34efcd84681c4991dffab959f1c8ecf41c1 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 19:58:41 -0500 Subject: [PATCH 27/39] Adding BDDAssertion support, javadoc --- .../eclipse/collections/api/Assertions.java | 26 +++++++- .../collections/api/BDDAssertions.java | 62 +++++++++++++++++++ .../api/multimap/bag/BagMultimapAssert.java | 6 ++ .../api/multimap/list/ListMultimapAssert.java | 6 ++ .../api/multimap/set/SetMultimapAssert.java | 6 ++ .../ShouldHaveDistinctSizeGreaterThan.java | 15 ++++- 6 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java index abab11f..cbb0be2 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java @@ -20,20 +20,42 @@ import org.eclipse.collections.api.multimap.list.ListMultimap; import org.eclipse.collections.api.multimap.set.SetMultimap; +/** + * Entry point for assertion methods for the Eclipse Collections library. Each method in this class is a static factory + * for a type-specific assertion object. + */ @CheckReturnValue public class Assertions { - private Assertions() { - throw new UnsupportedOperationException("Utility class"); + protected Assertions() { + // Do nothing } + /** + * Creates a new instance of {@link BagMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static BagMultimapAssert assertThat(BagMultimap actual) { return BagMultimapAssert.assertThat(actual); } + /** + * Creates a new instance of {@link ListMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static ListMultimapAssert assertThat(ListMultimap actual) { return ListMultimapAssert.assertThat(actual); } + /** + * Creates a new instance of {@link SetMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static SetMultimapAssert assertThat(SetMultimap actual) { return SetMultimapAssert.assertThat(actual); } diff --git a/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java new file mode 100644 index 0000000..66b830b --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java @@ -0,0 +1,62 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api; + +import org.assertj.core.util.CheckReturnValue; +import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; + +/** + * Behavior-driven development style entry point for assertion methods for the Eclipse Collections library. Each method + * in this class is a static factory for a type-specific assertion object. + */ +@CheckReturnValue +public class BDDAssertions extends Assertions { + protected BDDAssertions() { + // Do nothing + } + + /** + * Creates a new instance of {@link BagMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + public static BagMultimapAssert then(BagMultimap actual) { + return assertThat(actual); + } + + /** + * Creates a new instance of {@link ListMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + public static ListMultimapAssert then(ListMultimap actual) { + return assertThat(actual); + } + + /** + * Creates a new instance of {@link SetMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + public static SetMultimapAssert then(SetMultimap actual) { + return assertThat(actual); + } +} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java index 9d435ae..5faf498 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java @@ -17,6 +17,12 @@ public class BagMultimapAssert extends AbstractMultimapAssert, BagMultimap, KEY, VALUE> { + /** + * Creates a new instance of {@link BagMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static BagMultimapAssert assertThat(BagMultimap actual) { return new BagMultimapAssert<>(actual); } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java index 6deb7d1..561b989 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java @@ -18,6 +18,12 @@ public class ListMultimapAssert extends AbstractMultimapAssert, ListMultimap, KEY, VALUE> { + /** + * Creates a new instance of {@link ListMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static ListMultimapAssert assertThat(ListMultimap actual) { return new ListMultimapAssert<>(actual); } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java index 0b53ae9..7125a3f 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java @@ -17,6 +17,12 @@ public class SetMultimapAssert extends AbstractMultimapAssert, SetMultimap, KEY, VALUE> { + /** + * Creates a new instance of {@link SetMultimapAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ public static SetMultimapAssert assertThat(SetMultimap actual) { return new SetMultimapAssert<>(actual); } diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java index 5b51c3a..bd41094 100644 --- a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThan.java @@ -12,12 +12,23 @@ */ package org.assertj.eclipse.collections.error; +import static java.lang.String.format; + import org.assertj.core.error.BasicErrorMessageFactory; import org.assertj.core.error.ErrorMessageFactory; -import static java.lang.String.format; - +/** + * Creates an error message indicating that an assertion that verifies a minimum distinct size failed. + */ public class ShouldHaveDistinctSizeGreaterThan extends BasicErrorMessageFactory { + /** + * Creates a new {@link ShouldHaveDistinctSizeGreaterThan}. + * + * @param actual the actual value in the failed assertion. + * @param actualSize the size of {@code actual}. + * @param expectedMinSize the expected size. + * @return the created {@code ErrorMessageFactory}. + */ public static ErrorMessageFactory shouldHaveDistinctSizeGreaterThan(Object actual, int actualSize, int expectedMinSize) { return new ShouldHaveDistinctSizeGreaterThan(actual, actualSize, expectedMinSize); } From 76d46e5efb288af562f543ac401cbcdf68094e4b Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 21:00:17 -0500 Subject: [PATCH 28/39] Javadoc and polish --- ...ipseCollectionsSoftAssertionsProvider.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java index 38cd6c6..4699e2c 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java +++ b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java @@ -23,14 +23,35 @@ @CheckReturnValue public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider { + /** + * Creates a new, proxied instance of a {@link BagMultimapAssert} + * + * @param actual the path + * @return the created assertion object + */ + @SuppressWarnings("unchecked") default BagMultimapAssert assertThat(BagMultimap actual) { return this.proxy(BagMultimapAssert.class, BagMultimap.class, actual); } + /** + * Creates a new, proxied instance of a {@link ListMultimapAssert} + * + * @param actual the path + * @return the created assertion object + */ + @SuppressWarnings("unchecked") default ListMultimapAssert assertThat(ListMultimap actual) { return this.proxy(ListMultimapAssert.class, ListMultimap.class, actual); } + /** + * Creates a new, proxied instance of a {@link SetMultimapAssert} + * + * @param actual the path + * @return the created assertion object + */ + @SuppressWarnings("unchecked") default SetMultimapAssert assertThat(SetMultimap actual) { return this.proxy(SetMultimapAssert.class, SetMultimap.class, actual); } From 090d64ac5b1fe090c57b852d72ee2fc77e3e9d66 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Sun, 9 Feb 2025 22:50:33 -0500 Subject: [PATCH 29/39] Add hasSizeBetween assertion --- .../api/multimap/AbstractMultimapAssert.java | 31 +++++ ...ultimapAssert_HasSizeBetween_Contract.java | 119 ++++++++++++++++++ ...BagMultimapAssert_HasSizeBetween_Test.java | 61 +++++++++ ...istMultimapAssert_HasSizeBetween_Test.java | 61 +++++++++ ...SetMultimapAssert_HasSizeBetween_Test.java | 61 +++++++++ 5 files changed, 333 insertions(+) create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index b7f039a..7f74ea7 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -22,6 +22,7 @@ import static org.assertj.core.error.ShouldContainValue.shouldContainValue; import static org.assertj.core.error.ShouldContainValues.shouldContainValues; import static org.assertj.core.error.ShouldHaveSize.shouldHaveSize; +import static org.assertj.core.error.ShouldHaveSizeBetween.shouldHaveSizeBetween; import static org.assertj.core.error.ShouldHaveSizeGreaterThan.shouldHaveSizeGreaterThan; import static org.assertj.core.error.ShouldHaveSizeGreaterThanOrEqualTo.shouldHaveSizeGreaterThanOrEqualTo; import static org.assertj.core.error.ShouldHaveSizeLessThan.shouldHaveSizeLessThan; @@ -287,6 +288,36 @@ public SELF hasSize(int expected) { throw this.assertionError(shouldHaveSize(this.actual, actualSize, expected)); } + /** + * Verifies that the number of key-value entry pairs in the {@link Multimap} is between the given boundaries + * (inclusive). + *

+ * Example: + *

{@code
+   * Multimap multimap = Multimaps.mutable.list.with("Key1", "Value1", "Key1", "Value2", "Key2", "Value3");
+   *
+   * // assertion will pass
+   * assertThat(multimap).hasSizeBetween(1, 4)
+   *                     .hasSizeBetween(2, 3);
+   *
+   * // assertions will fail
+   * assertThat(multimap).hasSizeBetween(4, 5);
+   * }
+ * + * @param lowerBoundary the lower boundary compared to which actual size should be greater than or equal to. + * @param higherBoundary the higher boundary compared to which actual size should be less than or equal to. + * @return {@code this} assertion object. + * @throws AssertionError if the actual size of the {@link Multimap} is not between the given boundaries. + */ + public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) { + this.isNotNull(); + int actualSize = this.actual.size(); + if (actualSize >= lowerBoundary && actualSize <= higherBoundary) { + return this.myself; + } + throw this.assertionError(shouldHaveSizeBetween(this.actual, actualSize, lowerBoundary, higherBoundary)); + } + /** * Verifies that the number of key-value entry pairs in the {@link Multimap} is greater than the specified boundary. *

diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java new file mode 100644 index 0000000..5e572a9 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java @@ -0,0 +1,119 @@ +package org.assertj.eclipse.collections.api.multimap; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +import java.util.Objects; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +public interface AbstractMultimapAssert_HasSizeBetween_Contract, A extends AbstractMultimapAssert> { + I testInput(); + + I emptyInput(); + + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + Boundaries withinBoundaries(); + + Boundaries withinBoundariesInclusiveUpper(); + + Boundaries withinBoundariesInclusiveLower(); + + Boundaries belowLowerBoundary(); + + Boundaries aboveUpperBoundary(); + + /** + * Test data input that always returns null. Used for testing how assertions handle null. + */ + default I nullInput() { + return null; + } + + @Test + default void passesSizeBetween() { + assertion(testInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary()); + } + + @Test + default void passesSizeBetweenInclusiveUpper() { + assertion(testInput()).hasSizeBetween(withinBoundariesInclusiveUpper().lowerBoundary(), withinBoundariesInclusiveUpper().upperBoundary()); + } + + @Test + default void passesSizeBetweenInclusiveLower() { + assertion(testInput()).hasSizeBetween(withinBoundariesInclusiveLower().lowerBoundary(), withinBoundariesInclusiveLower().upperBoundary()); + } + + @Test + default void failsSizeFallsBelowLowerBoundary() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeBetween(belowLowerBoundary().lowerBoundary(), belowLowerBoundary().upperBoundary())) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", belowLowerBoundary().lowerBoundary(), belowLowerBoundary().upperBoundary(), testInput().size())); + } + + @Test + default void failsSizeFallsAboveUpperBoundary() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasSizeBetween(aboveUpperBoundary().lowerBoundary(), aboveUpperBoundary().upperBoundary())) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", aboveUpperBoundary().lowerBoundary(), aboveUpperBoundary().upperBoundary(), testInput().size())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsEmptyMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary(), emptyInput().size())); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())); + } + + final class Boundaries { + private final int lowerBoundary; + private final int upperBoundary; + + public Boundaries(int lowerBoundary, int upperBoundary) { + this.lowerBoundary = lowerBoundary; + this.upperBoundary = upperBoundary; + } + + public int lowerBoundary() { + return lowerBoundary; + } + + public int upperBoundary() { + return upperBoundary; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Boundaries)) return false; + Boundaries that = (Boundaries) o; + return lowerBoundary == that.lowerBoundary && upperBoundary == that.upperBoundary; + } + + @Override + public int hashCode() { + return Objects.hash(lowerBoundary, upperBoundary); + } + + @Override + public String toString() { + return lowerBoundary + ".." + upperBoundary; + } + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java new file mode 100644 index 0000000..82761b7 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, BagMultimapAssert> { + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Boundaries withinBoundaries() { + return new Boundaries(25, 50); + } + + @Override + public Boundaries withinBoundariesInclusiveUpper() { + return new Boundaries(25, 38); + } + + @Override + public Boundaries withinBoundariesInclusiveLower() { + return new Boundaries(38, 50); + } + + @Override + public Boundaries belowLowerBoundary() { + return new Boundaries(50, 57); + } + + @Override + public Boundaries aboveUpperBoundary() { + return new Boundaries(25, 32); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java new file mode 100644 index 0000000..a91c5ab --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, ListMultimapAssert> { + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Boundaries withinBoundaries() { + return new Boundaries(25, 50); + } + + @Override + public Boundaries withinBoundariesInclusiveUpper() { + return new Boundaries(25, 38); + } + + @Override + public Boundaries withinBoundariesInclusiveLower() { + return new Boundaries(38, 50); + } + + @Override + public Boundaries belowLowerBoundary() { + return new Boundaries(50, 57); + } + + @Override + public Boundaries aboveUpperBoundary() { + return new Boundaries(25, 32); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java new file mode 100644 index 0000000..7c6a4b2 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java @@ -0,0 +1,61 @@ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, SetMultimapAssert> { + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public Boundaries withinBoundaries() { + return new Boundaries(25, 50); + } + + @Override + public Boundaries withinBoundariesInclusiveUpper() { + return new Boundaries(25, 38); + } + + @Override + public Boundaries withinBoundariesInclusiveLower() { + return new Boundaries(38, 50); + } + + @Override + public Boundaries belowLowerBoundary() { + return new Boundaries(50, 57); + } + + @Override + public Boundaries aboveUpperBoundary() { + return new Boundaries(25, 32); + } +} From 24469f53b33a1738964c1bb7c1c2aecadae11868 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Mon, 10 Feb 2025 07:49:33 -0500 Subject: [PATCH 30/39] Add license --- ...stractMultimapAssert_HasSizeBetween_Contract.java | 12 ++++++++++++ .../bag/BagMultimapAssert_HasSizeBetween_Test.java | 12 ++++++++++++ .../list/ListMultimapAssert_HasSizeBetween_Test.java | 12 ++++++++++++ .../set/SetMultimapAssert_HasSizeBetween_Test.java | 12 ++++++++++++ 4 files changed, 48 insertions(+) diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java index 5e572a9..c085003 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java index 82761b7..5a3713c 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.bag; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java index a91c5ab..e7fbec6 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.list; import org.assertj.eclipse.collections.api.SoftAssertions; diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java index 7c6a4b2..a313723 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java @@ -1,3 +1,15 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ package org.assertj.eclipse.collections.api.multimap.set; import org.assertj.eclipse.collections.api.SoftAssertions; From 588bab385647303e54202a290590eb752d6a5d34 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Mon, 10 Feb 2025 18:25:04 -0500 Subject: [PATCH 31/39] Add hasDistinctSizeGreaterThanOrEqualTo assertion --- .../api/multimap/AbstractMultimapAssert.java | 21 ++++- ...dHaveDistinctSizeGreaterThanOrEqualTo.java | 44 +++++++++++ ...inctSizeGreaterThanOrEqualTo_Contract.java | 76 +++++++++++++++++++ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 +++++++++++++++ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 +++++++++++++++ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 +++++++++++++++ 6 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThanOrEqualTo.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 7f74ea7..e037531 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -30,6 +30,7 @@ import static org.assertj.core.error.ShouldNotBeEmpty.shouldNotBeEmpty; import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSize.shouldHaveDistinctSize; import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSizeGreaterThan.shouldHaveDistinctSizeGreaterThan; +import static org.assertj.eclipse.collections.error.ShouldHaveDistinctSizeGreaterThanOrEqualTo.shouldHaveDistinctSizeGreaterThanOrEqualTo; import java.util.Map; @@ -226,10 +227,10 @@ public SELF hasDistinctSize(int expected) { } /** - * Verifies that the number of distinct keys in the {@link Multimap} is greater than the specified boundary. + * Verifies that the distinct size of the {@link Multimap} is greater than the specified boundary. * * @param boundary the size that the actual number of distinct keys should exceed. - * @return {@code this} assertion object for method chaining. + * @return this assertion object for method chaining. * @throws AssertionError if the actual distinct size of the {@link Multimap} is not greater than the specified boundary. */ public SELF hasDistinctSizeGreaterThan(int boundary) { @@ -241,6 +242,22 @@ public SELF hasDistinctSizeGreaterThan(int boundary) { throw this.assertionError(shouldHaveDistinctSizeGreaterThan(this.actual, actualSize, boundary)); } + /** + * Verifies that the distinct size of the {@link Multimap} is greater than or equal to the specified boundary. + * + * @param boundary the minimum distinct size to compare the Multimap against + * @return this assertion for method chaining + * @throws AssertionError if the distinct size of the collection is less than the specified boundary + */ + public SELF hasDistinctSizeGreaterThanOrEqualTo(int boundary) { + this.isNotNull(); + int actualSize = this.actual.sizeDistinct(); + if (actualSize >= boundary) { + return this.myself; + } + throw this.assertionError(shouldHaveDistinctSizeGreaterThanOrEqualTo(this.actual, actualSize, boundary)); + } + /** * Verifies that at least one key in the actual {@link Multimap} satisfies the given condition. * diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThanOrEqualTo.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThanOrEqualTo.java new file mode 100644 index 0000000..207bda6 --- /dev/null +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSizeGreaterThanOrEqualTo.java @@ -0,0 +1,44 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.error; + +import org.assertj.core.error.BasicErrorMessageFactory; +import org.assertj.core.error.ErrorMessageFactory; + +import static java.lang.String.format; + +/** + * Creates an error message indicating that an assertion verifying that the distinct size of a value + * is greater than or equal to a specified minimum size has failed. + */ +public class ShouldHaveDistinctSizeGreaterThanOrEqualTo extends BasicErrorMessageFactory { + /** + * Creates a new {@link ShouldHaveDistinctSizeGreaterThanOrEqualTo}. + * + * @param actual the actual value in the failed assertion. + * @param actualSize the size of {@code actual}. + * @param expectedMinSize the expected size. + * @return the created {@code ErrorMessageFactory}. + */ + public static ErrorMessageFactory shouldHaveDistinctSizeGreaterThanOrEqualTo(Object actual, int actualSize, int expectedMinSize) { + return new ShouldHaveDistinctSizeGreaterThanOrEqualTo(actual, actualSize, expectedMinSize); + } + + private ShouldHaveDistinctSizeGreaterThanOrEqualTo(Object actual, int actualSize, int expectedSize) { + super(format("%n" + + "Expecting distinct size of:%n" + + " %%s%n" + + "to be greater than or equal to %s but was %s", expectedSize, actualSize), + actual); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java new file mode 100644 index 0000000..c909c9f --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java @@ -0,0 +1,76 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +public interface AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { + A assertion(I testInput); + + A softAssertion(SoftAssertions softAssertions, I testInput); + + I testInput(); + + I emptyInput(); + + int upperBoundary(); + + int lowerBoundary(); + + int equalsBoundary(); + + default I nullInput() { + return null; + } + + @Test + default void passesGreaterThan() { + assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary()); + } + + @Test + default void passesEqual() { + assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(equalsBoundary()); + } + + @Test + default void failsLessThan() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(upperBoundary())) + .withMessageContaining("Expecting distinct size of") + .withMessageContaining(String.format("to be greater than or equal to %s but was %s", upperBoundary(), testInput().sizeDistinct())); + } + + @Test + default void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(nullInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + default void failsEmptyMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> assertion(emptyInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())) + .withMessageContaining(String.format("to be greater than or equal to %s but was 0", lowerBoundary())); + } + + @Test + default void softAssertionPasses() { + SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..9409c8a --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,63 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap.bag; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { + @Override + public BagMultimapAssert assertion(BagMultimap testInput) { + return BagMultimapAssert.assertThat(testInput); + } + + @Override + public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public BagMultimap testInput() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public BagMultimap emptyInput() { + return Multimaps.immutable.bag.empty(); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..94cbabf --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,63 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap.list; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { + @Override + public ListMultimapAssert assertion(ListMultimap testInput) { + return ListMultimapAssert.assertThat(testInput); + } + + @Override + public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public ListMultimap testInput() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public ListMultimap emptyInput() { + return Multimaps.immutable.list.empty(); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java new file mode 100644 index 0000000..dcb177b --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -0,0 +1,63 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap.set; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; + +public class SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { + @Override + public SetMultimapAssert assertion(SetMultimap testInput) { + return SetMultimapAssert.assertThat(testInput); + } + + @Override + public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { + return softAssertions.assertThat(testInput); + } + + @Override + public SetMultimap testInput() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + @Override + public SetMultimap emptyInput() { + return Multimaps.immutable.set.empty(); + } + + @Override + public int upperBoundary() { + return 10; + } + + @Override + public int lowerBoundary() { + return 2; + } + + @Override + public int equalsBoundary() { + return 5; + } +} From 5f2f2913098d843721b1f172b4b140ec60a5aeac Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Mon, 10 Feb 2025 18:34:39 -0500 Subject: [PATCH 32/39] Clean up unchecked warnings --- .../api/multimap/AbstractMultimapAssert.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index e037531..12cf6d2 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -159,8 +159,7 @@ public SELF containsKeys(KEY... keys) { */ @SafeVarargs public final SELF containsOnly(Map.Entry... entries) { - @SuppressWarnings("unchecked") - Pair[] pairs = ArrayAdapter.adapt(entries).collect(Tuples::pairFrom).toArray(new Pair[entries.length]); + MutableList> pairs = Lists.mutable.of(entries).collect(Tuples::pairFrom); return this.containsOnlyForProxy(pairs); } @@ -173,13 +172,12 @@ public final SELF containsOnly(Map.Entry... entr */ @SafeVarargs public final SELF containsOnly(Pair... entries) { - return this.containsOnlyForProxy(entries); + return this.containsOnlyForProxy(Lists.mutable.of(entries)); } - protected SELF containsOnlyForProxy(Pair[] entries) { + protected SELF containsOnlyForProxy(MutableList> entries) { this.isNotNull(); - PartitionMutableList> partition = ArrayAdapter - .adapt(entries) + PartitionMutableList> partition = entries .partition(entry -> this.actual.containsKeyAndValue(entry.getOne(), entry.getTwo())); MutableList> found = partition.getSelected(); From 6d40019693a8e58e906c59cdd959314c7a7da7cf Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Mon, 10 Feb 2025 18:43:18 -0500 Subject: [PATCH 33/39] Update scope --- ...MultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java | 2 +- .../bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java | 2 +- ...MultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java | 2 +- .../ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java | 2 +- ...MultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java | 2 +- .../set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java index 9409c8a..8a14237 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { +class BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { @Override public BagMultimapAssert assertion(BagMultimap testInput) { return BagMultimapAssert.assertThat(testInput); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java index 8bcf1bc..979e9f8 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class BagMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, BagMultimapAssert> { +class BagMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, BagMultimapAssert> { @Override public BagMultimap testInput() { MutableBagMultimap multimap = Multimaps.mutable.bag.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java index 94cbabf..6baceb0 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.list.MutableListMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { +class ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { @Override public ListMultimapAssert assertion(ListMultimap testInput) { return ListMultimapAssert.assertThat(testInput); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java index 0d71150..b04c9b6 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.list.MutableListMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class ListMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, ListMultimapAssert> { +class ListMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, ListMultimapAssert> { @Override public ListMultimap testInput() { MutableListMultimap multimap = Multimaps.mutable.list.of(); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java index dcb177b..6b9d2fe 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.set.SetMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { +class SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { @Override public SetMultimapAssert assertion(SetMultimap testInput) { return SetMultimapAssert.assertThat(testInput); diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java index fccc0f1..aa36b71 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -19,7 +19,7 @@ import org.eclipse.collections.api.multimap.set.SetMultimap; import org.eclipse.collections.impl.factory.Multimaps; -public class SetMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, SetMultimapAssert> { +class SetMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, SetMultimapAssert> { @Override public SetMultimap testInput() { MutableSetMultimap multimap = Multimaps.mutable.set.of(); From acfd7d7bdc9a89805d99e07b57bbd82e2f18c2e2 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Thu, 13 Feb 2025 22:18:47 -0500 Subject: [PATCH 34/39] Fixing javadoc warnings and adding docs --- pom.xml | 7 +++++++ .../eclipse/collections/api/Assertions.java | 9 +++++++++ .../collections/api/BDDAssertions.java | 9 +++++++++ .../collections/api/SoftAssertions.java | 16 +++++++++++++++ .../api/multimap/bag/BagMultimapAssert.java | 20 +++++++++++++++++-- .../api/multimap/list/ListMultimapAssert.java | 15 ++++++++++++++ .../api/multimap/set/SetMultimapAssert.java | 15 ++++++++++++++ 7 files changed, 89 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 10d04ed..42022fc 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,13 @@ ${eclipse-collections.version} provided + + org.opentest4j + opentest4j + 1.3.0 + provided + true + org.junit.jupiter diff --git a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java index cbb0be2..166149a 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java @@ -26,6 +26,9 @@ */ @CheckReturnValue public class Assertions { + /** + * Creates a new {@link Assertions}. + */ protected Assertions() { // Do nothing } @@ -35,6 +38,8 @@ protected Assertions() { * * @param actual the actual value. * @return the created assertion object. + * @param The type of keys in the BagMultimap + * @param The type of values in the BagMultimap */ public static BagMultimapAssert assertThat(BagMultimap actual) { return BagMultimapAssert.assertThat(actual); @@ -45,6 +50,8 @@ public static BagMultimapAssert assertThat(BagMultimap< * * @param actual the actual value. * @return the created assertion object. + * @param The type of keys in the ListMultimap + * @param The type of values in the ListMultimap */ public static ListMultimapAssert assertThat(ListMultimap actual) { return ListMultimapAssert.assertThat(actual); @@ -55,6 +62,8 @@ public static ListMultimapAssert assertThat(ListMultima * * @param actual the actual value. * @return the created assertion object. + * @param The type of keys in the SetMultimap + * @param The type of values in the SetMultimap */ public static SetMultimapAssert assertThat(SetMultimap actual) { return SetMultimapAssert.assertThat(actual); diff --git a/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java index 66b830b..0422ccc 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java @@ -26,6 +26,9 @@ */ @CheckReturnValue public class BDDAssertions extends Assertions { + /** + * Creates a new {@link BDDAssertions}. + */ protected BDDAssertions() { // Do nothing } @@ -35,6 +38,8 @@ protected BDDAssertions() { * * @param actual the actual value. * @return the created assertion object. + * @param The type of keys in the BagMultimap + * @param The type of values in the BagMultimap */ public static BagMultimapAssert then(BagMultimap actual) { return assertThat(actual); @@ -45,6 +50,8 @@ public static BagMultimapAssert then(BagMultimap The type of keys in the ListMultimap + * @param The type of values in the ListMultimap */ public static ListMultimapAssert then(ListMultimap actual) { return assertThat(actual); @@ -55,6 +62,8 @@ public static ListMultimapAssert then(ListMultimap The type of keys in the SetMultimap + * @param The type of values in the SetMultimap */ public static SetMultimapAssert then(SetMultimap actual) { return assertThat(actual); diff --git a/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java index c8c527d..abc0c64 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java @@ -14,14 +14,30 @@ import org.assertj.core.api.AbstractSoftAssertions; import org.assertj.core.api.SoftAssertionsProvider; +import org.opentest4j.MultipleFailuresError; import java.util.function.Consumer; +/** + * A soft assertions provider for Eclipse Collections assertions + */ public class SoftAssertions extends AbstractSoftAssertions implements EclipseCollectionsSoftAssertionsProvider { + /** + * Creates a new {@link SoftAssertions}. + */ public SoftAssertions() { // Do nothing } + /** + * Convenience method for calling {@link EclipseCollectionsSoftAssertionsProvider#assertSoftly} for these assertion + * types. Equivalent to {@code SoftAssertion.assertSoftly(SoftAssertions.class, softly)}. + * + * @param softly the Consumer containing the code that will make the soft assertions. + * Takes one parameter (the SoftAssertions instance used to make the assertions). + * @throws MultipleFailuresError if possible or SoftAssertionError if any proxied assertion objects threw an {@link + * AssertionError} + */ public static void assertSoftly(Consumer softly) { SoftAssertionsProvider.assertSoftly(SoftAssertions.class, softly); } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java index 5faf498..841e3b8 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java @@ -12,9 +12,20 @@ */ package org.assertj.eclipse.collections.api.multimap.bag; +import org.assertj.eclipse.collections.api.Assertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; +import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; import org.eclipse.collections.api.multimap.bag.BagMultimap; +/** + * Assertion methods for {@link BagMultimap}s. + *

+ * To create an instance of this class, invoke {@link Assertions#assertThat(BagMultimap)}. + *

+ * + * @param the type of keys in the BagMultimap. + * @param the type of values in the BagMultimap. + */ public class BagMultimapAssert extends AbstractMultimapAssert, BagMultimap, KEY, VALUE> { /** @@ -22,12 +33,17 @@ public class BagMultimapAssert extends AbstractMultimapAssert The type of keys in the actual BagMultimap + * @param The type of values in the actual BagMultimap */ public static BagMultimapAssert assertThat(BagMultimap actual) { return new BagMultimapAssert<>(actual); } - public BagMultimapAssert(BagMultimap keyvalueBagMultimap) { - super(keyvalueBagMultimap, BagMultimapAssert.class); + /** + * Creates a new {@link BagMultimapAssert}. + */ + public BagMultimapAssert(BagMultimap actual) { + super(actual, BagMultimapAssert.class); } } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java index 561b989..5fc4ae6 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java @@ -12,9 +12,19 @@ */ package org.assertj.eclipse.collections.api.multimap.list; +import org.assertj.eclipse.collections.api.Assertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; import org.eclipse.collections.api.multimap.list.ListMultimap; +/** + * Assertion methods for {@link ListMultimap}s. + *

+ * To create an instance of this class, invoke {@link Assertions#assertThat(ListMultimap)}. + *

+ * + * @param the type of keys in the ListMultimap. + * @param the type of values in the ListMultimap. + */ public class ListMultimapAssert extends AbstractMultimapAssert, ListMultimap, KEY, VALUE> { @@ -23,11 +33,16 @@ public class ListMultimapAssert * * @param actual the actual value. * @return the created assertion object. + * @param The type of keys in th actual ListMultimap + * @param The type of values in the actual ListMultimap */ public static ListMultimapAssert assertThat(ListMultimap actual) { return new ListMultimapAssert<>(actual); } + /** + * Creates a new {@link ListMultimapAssert}. + */ public ListMultimapAssert(ListMultimap actual) { super(actual, ListMultimapAssert.class); } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java index 7125a3f..d505da5 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java @@ -12,9 +12,19 @@ */ package org.assertj.eclipse.collections.api.multimap.set; +import org.assertj.eclipse.collections.api.Assertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; import org.eclipse.collections.api.multimap.set.SetMultimap; +/** + * Assertion methods for {@link SetMultimap}s. + *

+ * To create an instance of this class, invoke {@link Assertions#assertThat(SetMultimap)}. + *

+ * + * @param the type of keys in the SetMultimap. + * @param the type of values in the SetMultimap. + */ public class SetMultimapAssert extends AbstractMultimapAssert, SetMultimap, KEY, VALUE> { /** @@ -22,11 +32,16 @@ public class SetMultimapAssert extends AbstractMultimapAssert The type of keys in the actual SetMultimap + * @param The type of values in the actual SetMultimap */ public static SetMultimapAssert assertThat(SetMultimap actual) { return new SetMultimapAssert<>(actual); } + /** + * Creates a new {@link SetMultimapAssert}. + */ public SetMultimapAssert(SetMultimap actual) { super(actual, SetMultimapAssert.class); } From e090dddb69bb2f4d8036002d966b98843b6301f3 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Thu, 13 Feb 2025 22:26:51 -0500 Subject: [PATCH 35/39] Fix more javadoc warnings --- ...ipseCollectionsSoftAssertionsProvider.java | 9 +++++++++ .../api/multimap/AbstractMultimapAssert.java | 20 ++++++++++++++++++- .../api/multimap/bag/BagMultimapAssert.java | 2 +- .../api/multimap/list/ListMultimapAssert.java | 1 + .../api/multimap/set/SetMultimapAssert.java | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java index 4699e2c..629c494 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java +++ b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java @@ -21,6 +21,9 @@ import org.eclipse.collections.api.multimap.list.ListMultimap; import org.eclipse.collections.api.multimap.set.SetMultimap; +/** + * Soft assertions implementations for Eclipse Collections types. + */ @CheckReturnValue public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider { /** @@ -28,6 +31,8 @@ public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertions * * @param actual the path * @return the created assertion object + * @param The type of keys in the actual BagMultimap + * @param The type of values in the actual BagMultimap */ @SuppressWarnings("unchecked") default BagMultimapAssert assertThat(BagMultimap actual) { @@ -39,6 +44,8 @@ default BagMultimapAssert assertThat(BagMultimap The type of keys in the actual ListMultimap + * @param The type of values in the actual ListMultimap */ @SuppressWarnings("unchecked") default ListMultimapAssert assertThat(ListMultimap actual) { @@ -50,6 +57,8 @@ default ListMultimapAssert assertThat(ListMultimap The type of keys in the actual SetMultimap + * @param The type of values in the actual SetMultimap */ @SuppressWarnings("unchecked") default SetMultimapAssert assertThat(SetMultimap actual) { diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java index 12cf6d2..e41af32 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java @@ -43,7 +43,6 @@ import org.eclipse.collections.api.multimap.Multimap; import org.eclipse.collections.api.partition.list.PartitionMutableList; import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.list.fixed.ArrayAdapter; import org.eclipse.collections.impl.tuple.Tuples; /** @@ -57,6 +56,11 @@ public abstract class AbstractMultimapAssert, ACTUAL extends Multimap, KEY, VALUE> extends AbstractObjectAssert { + /** + * Creates a new {@link AbstractMultimapAssert}. + * @param actual The actual Multimap to assert against + * @param selfType The "self" type of child assert class + */ protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { super(actual, selfType); } @@ -99,6 +103,13 @@ public final SELF contains(Map.Entry... entries) { return this.containsForProxy(pairs); } + /** + * Verifies that the actual {@code Multimap} contains the provided entries. + * + * @param entries the list of entries that are expected to be contained within the {@code Multimap}. + * @return this assertion object for method chaining. + * @throws AssertionError if the actual {@code Multimap} does not contain one or more of the specified entries. + */ protected SELF containsForProxy(MutableList> entries) { this.isNotNull(); MutableList> entriesNotFound = entries @@ -175,6 +186,13 @@ public final SELF containsOnly(Pair... entries) return this.containsOnlyForProxy(Lists.mutable.of(entries)); } + /** + * Verifies that the current object contains only the specified list of pairs of key-value entries. + * + * @param entries the list of pairs of key-value entries to check against + * @return this assertion object for method chaining + * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. + */ protected SELF containsOnlyForProxy(MutableList> entries) { this.isNotNull(); PartitionMutableList> partition = entries diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java index 841e3b8..24fd687 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java @@ -14,7 +14,6 @@ import org.assertj.eclipse.collections.api.Assertions; import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; import org.eclipse.collections.api.multimap.bag.BagMultimap; /** @@ -42,6 +41,7 @@ public static BagMultimapAssert assertThat(BagMultimap< /** * Creates a new {@link BagMultimapAssert}. + * @param actual The actual value to assert against */ public BagMultimapAssert(BagMultimap actual) { super(actual, BagMultimapAssert.class); diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java index 5fc4ae6..e198f0e 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java @@ -42,6 +42,7 @@ public static ListMultimapAssert assertThat(ListMultima /** * Creates a new {@link ListMultimapAssert}. + * @param actual The actual value to assert against */ public ListMultimapAssert(ListMultimap actual) { super(actual, ListMultimapAssert.class); diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java index d505da5..b6d10bc 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java @@ -41,6 +41,7 @@ public static SetMultimapAssert assertThat(SetMultimap< /** * Creates a new {@link SetMultimapAssert}. + * @param actual The actual value to assert against */ public SetMultimapAssert(SetMultimap actual) { super(actual, SetMultimapAssert.class); From 05119186a9b87664bce8fe7552d728cbca369193 Mon Sep 17 00:00:00 2001 From: Stefano Cordio Date: Sat, 29 Mar 2025 16:25:25 +0100 Subject: [PATCH 36/39] Polishing --- README.md | 4 ++-- pom.xml | 17 +++++++++-------- .../error/ShouldHaveDistinctSize.java | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1cf7697..cf76cca 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# AssertJ Eclipse Collections +# AssertJ Eclipse Collections [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) -[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) +[![CI](https://github.com/assertj/assertj/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/assertj/assertj/actions/workflows/main.yml?query=branch%3Amain) diff --git a/pom.xml b/pom.xml index 42022fc..3258bb6 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,14 @@ + + + mattbertolini + Matt Bertolini + https://github.com/mattbertolini + + + scm:git:https://github.com/assertj/assertj-eclipse-collections.git scm:git:https://github.com/assertj/assertj-eclipse-collections.git @@ -33,7 +41,7 @@ 3.27.3 13.0.0 - 5.11.4 + 5.12.1 @@ -44,12 +52,6 @@ ${assertj.version}
- - org.eclipse.collections - eclipse-collections-api - ${eclipse-collections.version} - provided - org.eclipse.collections eclipse-collections @@ -59,7 +61,6 @@ org.opentest4j opentest4j - 1.3.0 provided true diff --git a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java index 52d1c73..1e9a28d 100644 --- a/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java +++ b/src/main/java/org/assertj/eclipse/collections/error/ShouldHaveDistinctSize.java @@ -18,7 +18,7 @@ import static java.lang.String.format; /** - * Creates an error message indicating that an assertion that verifies that a value have certain distinct size failed. + * Creates an error message indicating that an assertion that verifies that a value has certain distinct size failed. */ public class ShouldHaveDistinctSize extends BasicErrorMessageFactory { /** From 77a24df67b9a5072c4339b4f4a936d0dc77be7fd Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Fri, 11 Apr 2025 17:47:08 -0400 Subject: [PATCH 37/39] Simplify test setup by simplifying the Multimap assert. Since there is no different between the three different multimap assert types we can collapse them into one assertion type. --- .../eclipse/collections/api/Assertions.java | 38 +-- .../collections/api/BDDAssertions.java | 36 +-- ...ipseCollectionsSoftAssertionsProvider.java | 40 +--- ...ultimapAssert.java => MultimapAssert.java} | 61 +++-- .../api/multimap/bag/BagMultimapAssert.java | 49 ---- .../api/multimap/list/ListMultimapAssert.java | 50 ---- .../api/multimap/set/SetMultimapAssert.java | 49 ---- ...MultimapAssert_ContainsEntry_Contract.java | 70 ------ ...tMultimapAssert_ContainsKeys_Contract.java | 75 ------ ...tMultimapAssert_ContainsOnly_Contract.java | 133 ----------- ...ultimapAssert_ContainsValues_Contract.java | 75 ------ ...tractMultimapAssert_Contains_Contract.java | 102 --------- ...inctSizeGreaterThanOrEqualTo_Contract.java | 76 ------ ...t_HasDistinctSizeGreaterThan_Contract.java | 82 ------- ...ltimapAssert_HasDistinctSize_Contract.java | 62 ----- ...timapAssert_HasKeySatisfying_Contract.java | 62 ----- ...ultimapAssert_HasSizeBetween_Contract.java | 131 ----------- ..._HasSizeGreaterThanOrEqualTo_Contract.java | 76 ------ ...mapAssert_HasSizeGreaterThan_Contract.java | 82 ------- ...ert_HasSizeLessThanOrEqualTo_Contract.java | 69 ------ ...ltimapAssert_HasSizeLessThan_Contract.java | 72 ------ ...stractMultimapAssert_HasSize_Contract.java | 62 ----- ...mapAssert_HasValueSatisfying_Contract.java | 62 ----- ...stractMultimapAssert_IsEmpty_Contract.java | 57 ----- ...actMultimapAssert_IsNotEmpty_Contract.java | 57 ----- ...MultimapAssert_IsNullOrEmpty_Contract.java | 60 ----- .../MultimapAssert_ContainsEntry_Test.java | 67 ++++++ .../MultimapAssert_ContainsKeys_Test.java | 64 ++++++ .../MultimapAssert_ContainsOnly_Test.java | 185 +++++++++++++++ .../MultimapAssert_ContainsValues_Test.java | 64 ++++++ .../MultimapAssert_Contains_Test.java | 123 ++++++++++ ...ssert_HasDistinctSizeGreaterThan_Test.java | 73 ++++++ .../MultimapAssert_HasDistinctSize_Test.java | 53 +++++ .../MultimapAssert_HasKeySatisfying_Test.java | 56 +++++ .../MultimapAssert_HasSizeBetween_Test.java | 80 +++++++ ...ultimapAssert_HasSizeGreaterThan_Test.java | 70 ++++++ ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 59 +++++ .../MultimapAssert_HasSizeLessThan_Test.java | 62 +++++ .../multimap/MultimapAssert_HasSize_Test.java | 52 +++++ ...ultimapAssert_HasValueSatisfying_Test.java | 73 ++++++ .../multimap/MultimapAssert_IsEmpty_Test.java | 53 +++++ .../MultimapAssert_IsNotEmpty_Test.java | 56 +++++ .../MultimapAssert_IsNullOrEmpty_Test.java | 55 +++++ .../api/multimap/MultimapTestData.java | 216 ++++++++++++++++++ .../BagMultimapAssert_ContainsEntry_Test.java | 62 ----- .../BagMultimapAssert_ContainsKeys_Test.java | 58 ----- .../BagMultimapAssert_ContainsOnly_Test.java | 112 --------- ...BagMultimapAssert_ContainsValues_Test.java | 58 ----- .../bag/BagMultimapAssert_Contains_Test.java | 73 ------ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ssert_HasDistinctSizeGreaterThan_Test.java | 63 ----- ...agMultimapAssert_HasDistinctSize_Test.java | 53 ----- ...gMultimapAssert_HasKeySatisfying_Test.java | 59 ----- ...BagMultimapAssert_HasSizeBetween_Test.java | 73 ------ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ultimapAssert_HasSizeGreaterThan_Test.java | 63 ----- ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 63 ----- ...agMultimapAssert_HasSizeLessThan_Test.java | 63 ----- .../bag/BagMultimapAssert_HasSize_Test.java | 53 ----- ...ultimapAssert_HasValueSatisfying_Test.java | 59 ----- .../bag/BagMultimapAssert_IsEmpty_Test.java | 48 ---- .../BagMultimapAssert_IsNotEmpty_Test.java | 49 ---- .../BagMultimapAssert_IsNullOrEmpty_Test.java | 49 ---- ...ListMultimapAssert_ContainsEntry_Test.java | 62 ----- .../ListMultimapAssert_ContainsKeys_Test.java | 58 ----- .../ListMultimapAssert_ContainsOnly_Test.java | 112 --------- ...istMultimapAssert_ContainsValues_Test.java | 58 ----- .../ListMultimapAssert_Contains_Test.java | 73 ------ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ssert_HasDistinctSizeGreaterThan_Test.java | 63 ----- ...stMultimapAssert_HasDistinctSize_Test.java | 53 ----- ...tMultimapAssert_HasKeySatisfying_Test.java | 59 ----- ...istMultimapAssert_HasSizeBetween_Test.java | 73 ------ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ultimapAssert_HasSizeGreaterThan_Test.java | 63 ----- ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 63 ----- ...stMultimapAssert_HasSizeLessThan_Test.java | 64 ------ .../list/ListMultimapAssert_HasSize_Test.java | 53 ----- ...ultimapAssert_HasValueSatisfying_Test.java | 59 ----- .../list/ListMultimapAssert_IsEmpty_Test.java | 48 ---- .../ListMultimapAssert_IsNotEmpty_Test.java | 48 ---- ...ListMultimapAssert_IsNullOrEmpty_Test.java | 48 ---- .../SetMultimapAssert_ContainsEntry_Test.java | 62 ----- .../SetMultimapAssert_ContainsKeys_Test.java | 58 ----- .../SetMultimapAssert_ContainsOnly_Test.java | 112 --------- ...SetMultimapAssert_ContainsValues_Test.java | 58 ----- .../set/SetMultimapAssert_Contains_Test.java | 73 ------ ...DistinctSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ssert_HasDistinctSizeGreaterThan_Test.java | 63 ----- ...etMultimapAssert_HasDistinctSize_Test.java | 55 ----- ...tMultimapAssert_HasKeySatisfying_Test.java | 59 ----- ...SetMultimapAssert_HasSizeBetween_Test.java | 73 ------ ...sert_HasSizeGreaterThanOrEqualTo_Test.java | 63 ----- ...ultimapAssert_HasSizeGreaterThan_Test.java | 63 ----- ...pAssert_HasSizeLessThanOrEqualTo_Test.java | 63 ----- ...etMultimapAssert_HasSizeLessThan_Test.java | 63 ----- .../set/SetMultimapAssert_HasSize_Test.java | 54 ----- ...ultimapAssert_HasValueSatisfying_Test.java | 59 ----- .../set/SetMultimapAssert_IsEmpty_Test.java | 48 ---- .../SetMultimapAssert_IsNotEmpty_Test.java | 49 ---- .../SetMultimapAssert_IsNullOrEmpty_Test.java | 49 ---- 101 files changed, 1504 insertions(+), 5299 deletions(-) rename src/main/java/org/assertj/eclipse/collections/api/multimap/{AbstractMultimapAssert.java => MultimapAssert.java} (90%) delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java delete mode 100644 src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsEntry_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsKeys_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsOnly_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsValues_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_Contains_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeBetween_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeGreaterThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThanOrEqualTo_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThan_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSize_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasValueSatisfying_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNotEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNullOrEmpty_Test.java create mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapTestData.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java delete mode 100644 src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java diff --git a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java index 166149a..21cf91f 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/Assertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/Assertions.java @@ -13,12 +13,8 @@ package org.assertj.eclipse.collections.api; import org.assertj.core.util.CheckReturnValue; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.assertj.eclipse.collections.api.multimap.MultimapAssert; +import org.eclipse.collections.api.multimap.Multimap; /** * Entry point for assertion methods for the Eclipse Collections library. Each method in this class is a static factory @@ -34,38 +30,14 @@ protected Assertions() { } /** - * Creates a new instance of {@link BagMultimapAssert}. + * Creates a new instance of {@link MultimapAssert}. * * @param actual the actual value. * @return the created assertion object. * @param The type of keys in the BagMultimap * @param The type of values in the BagMultimap */ - public static BagMultimapAssert assertThat(BagMultimap actual) { - return BagMultimapAssert.assertThat(actual); - } - - /** - * Creates a new instance of {@link ListMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the ListMultimap - * @param The type of values in the ListMultimap - */ - public static ListMultimapAssert assertThat(ListMultimap actual) { - return ListMultimapAssert.assertThat(actual); - } - - /** - * Creates a new instance of {@link SetMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the SetMultimap - * @param The type of values in the SetMultimap - */ - public static SetMultimapAssert assertThat(SetMultimap actual) { - return SetMultimapAssert.assertThat(actual); + public static MultimapAssert assertThat(Multimap actual) { + return new MultimapAssert<>(actual); } } diff --git a/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java index 0422ccc..719f656 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java +++ b/src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java @@ -13,12 +13,8 @@ package org.assertj.eclipse.collections.api; import org.assertj.core.util.CheckReturnValue; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.assertj.eclipse.collections.api.multimap.MultimapAssert; +import org.eclipse.collections.api.multimap.Multimap; /** * Behavior-driven development style entry point for assertion methods for the Eclipse Collections library. Each method @@ -34,38 +30,14 @@ protected BDDAssertions() { } /** - * Creates a new instance of {@link BagMultimapAssert}. + * Creates a new instance of {@link MultimapAssert}. * * @param actual the actual value. * @return the created assertion object. * @param The type of keys in the BagMultimap * @param The type of values in the BagMultimap */ - public static BagMultimapAssert then(BagMultimap actual) { - return assertThat(actual); - } - - /** - * Creates a new instance of {@link ListMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the ListMultimap - * @param The type of values in the ListMultimap - */ - public static ListMultimapAssert then(ListMultimap actual) { - return assertThat(actual); - } - - /** - * Creates a new instance of {@link SetMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the SetMultimap - * @param The type of values in the SetMultimap - */ - public static SetMultimapAssert then(SetMultimap actual) { + public static MultimapAssert then(Multimap actual) { return assertThat(actual); } } diff --git a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java index 629c494..e9b7cb8 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java +++ b/src/main/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java @@ -14,12 +14,8 @@ import org.assertj.core.api.SoftAssertionsProvider; import org.assertj.core.util.CheckReturnValue; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.list.ListMultimapAssert; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.assertj.eclipse.collections.api.multimap.MultimapAssert; +import org.eclipse.collections.api.multimap.Multimap; /** * Soft assertions implementations for Eclipse Collections types. @@ -27,7 +23,7 @@ @CheckReturnValue public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider { /** - * Creates a new, proxied instance of a {@link BagMultimapAssert} + * Creates a new, proxied instance of a {@link MultimapAssert} * * @param actual the path * @return the created assertion object @@ -35,33 +31,7 @@ public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertions * @param The type of values in the actual BagMultimap */ @SuppressWarnings("unchecked") - default BagMultimapAssert assertThat(BagMultimap actual) { - return this.proxy(BagMultimapAssert.class, BagMultimap.class, actual); - } - - /** - * Creates a new, proxied instance of a {@link ListMultimapAssert} - * - * @param actual the path - * @return the created assertion object - * @param The type of keys in the actual ListMultimap - * @param The type of values in the actual ListMultimap - */ - @SuppressWarnings("unchecked") - default ListMultimapAssert assertThat(ListMultimap actual) { - return this.proxy(ListMultimapAssert.class, ListMultimap.class, actual); - } - - /** - * Creates a new, proxied instance of a {@link SetMultimapAssert} - * - * @param actual the path - * @return the created assertion object - * @param The type of keys in the actual SetMultimap - * @param The type of values in the actual SetMultimap - */ - @SuppressWarnings("unchecked") - default SetMultimapAssert assertThat(SetMultimap actual) { - return this.proxy(SetMultimapAssert.class, SetMultimap.class, actual); + default MultimapAssert assertThat(Multimap actual) { + return this.proxy(MultimapAssert.class, Multimap.class, actual); } } diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert.java similarity index 90% rename from src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java rename to src/main/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert.java index e41af32..0b69d65 100644 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java +++ b/src/main/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert.java @@ -34,7 +34,7 @@ import java.util.Map; -import org.assertj.core.api.AbstractObjectAssert; +import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Condition; import org.assertj.core.error.GroupTypeDescription; import org.eclipse.collections.api.RichIterable; @@ -48,21 +48,18 @@ /** * Base class for all implementations of assertions for {@link Multimap}. * - * @param the "self" type of this assertion class. - * @param the type of the "actual" value. - * @param the type of keys in the Multimap. - * @param the type of values in the Multimap. + * @param the type of keys in the Multimap. + * @param the type of values in the Multimap. */ -public abstract class AbstractMultimapAssert, ACTUAL extends Multimap, KEY, VALUE> - extends AbstractObjectAssert { +public class MultimapAssert extends AbstractAssert, Multimap> { /** - * Creates a new {@link AbstractMultimapAssert}. + * Creates a new {@link MultimapAssert}. + * * @param actual The actual Multimap to assert against - * @param selfType The "self" type of child assert class */ - protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { - super(actual, selfType); + public MultimapAssert(Multimap actual) { + super(actual, MultimapAssert.class); } /** @@ -85,7 +82,7 @@ protected AbstractMultimapAssert(ACTUAL actual, Class selfType) { * @throws AssertionError if the actual {@link Multimap} does not contain the given entries */ @SafeVarargs - public final SELF contains(Pair... entries) { + public final MultimapAssert contains(Pair... entries) { return this.containsForProxy(Lists.mutable.of(entries)); } @@ -98,7 +95,7 @@ public final SELF contains(Pair... entries) { * @throws AssertionError if the actual {@code Multimap} does not contain one or more of the specified entries. */ @SafeVarargs - public final SELF contains(Map.Entry... entries) { + public final MultimapAssert contains(Map.Entry... entries) { MutableList> pairs = Lists.mutable.of(entries).collect(Tuples::pairFrom); return this.containsForProxy(pairs); } @@ -110,7 +107,7 @@ public final SELF contains(Map.Entry... entries) { * @return this assertion object for method chaining. * @throws AssertionError if the actual {@code Multimap} does not contain one or more of the specified entries. */ - protected SELF containsForProxy(MutableList> entries) { + protected MultimapAssert containsForProxy(MutableList> entries) { this.isNotNull(); MutableList> entriesNotFound = entries .reject(entry -> this.actual.containsKeyAndValue(entry.getOne(), entry.getTwo())); @@ -130,7 +127,7 @@ protected SELF containsForProxy(MutableList> entries) { * @see #contains(Pair[]) * @see #contains(Map.Entry[]) */ - public SELF containsEntry(KEY key, VALUE value) { + public MultimapAssert containsEntry(KEY key, VALUE value) { return this.contains(Tuples.pair(key, value)); } @@ -152,7 +149,7 @@ public SELF containsEntry(KEY key, VALUE value) { * @return this assertion object for method chaining. * @throws AssertionError if the actual {@link Multimap} does not contain the given keys. */ - public SELF containsKeys(KEY... keys) { + public MultimapAssert containsKeys(KEY... keys) { this.isNotNull(); MutableList keysNotFound = Lists.mutable.of(keys).reject(this.actual::containsKey); if (keysNotFound.isEmpty()) { @@ -169,7 +166,7 @@ public SELF containsKeys(KEY... keys) { * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. */ @SafeVarargs - public final SELF containsOnly(Map.Entry... entries) { + public final MultimapAssert containsOnly(Map.Entry... entries) { MutableList> pairs = Lists.mutable.of(entries).collect(Tuples::pairFrom); return this.containsOnlyForProxy(pairs); } @@ -182,7 +179,7 @@ public final SELF containsOnly(Map.Entry... entr * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. */ @SafeVarargs - public final SELF containsOnly(Pair... entries) { + public final MultimapAssert containsOnly(Pair... entries) { return this.containsOnlyForProxy(Lists.mutable.of(entries)); } @@ -193,7 +190,7 @@ public final SELF containsOnly(Pair... entries) * @return this assertion object for method chaining * @throws AssertionError if the actual {@link Multimap} does not contain only the given entries. */ - protected SELF containsOnlyForProxy(MutableList> entries) { + protected MultimapAssert containsOnlyForProxy(MutableList> entries) { this.isNotNull(); PartitionMutableList> partition = entries .partition(entry -> this.actual.containsKeyAndValue(entry.getOne(), entry.getTwo())); @@ -217,7 +214,7 @@ protected SELF containsOnlyForProxy(MutableList containsValues(VALUE... values) { this.isNotNull(); MutableList valuesNotFound = Lists.mutable.of(values).reject(this.actual::containsValue); if (valuesNotFound.isEmpty()) { @@ -233,7 +230,7 @@ public SELF containsValues(VALUE... values) { * @return this assertion object for method chaining. * @throws AssertionError if the actual number of distinct keys in the {@code Multimap} does not match the expected size. */ - public SELF hasDistinctSize(int expected) { + public MultimapAssert hasDistinctSize(int expected) { this.isNotNull(); int actualSize = this.actual.sizeDistinct(); if (actualSize == expected) { @@ -249,7 +246,7 @@ public SELF hasDistinctSize(int expected) { * @return this assertion object for method chaining. * @throws AssertionError if the actual distinct size of the {@link Multimap} is not greater than the specified boundary. */ - public SELF hasDistinctSizeGreaterThan(int boundary) { + public MultimapAssert hasDistinctSizeGreaterThan(int boundary) { this.isNotNull(); int actualSize = this.actual.sizeDistinct(); if (actualSize > boundary) { @@ -265,7 +262,7 @@ public SELF hasDistinctSizeGreaterThan(int boundary) { * @return this assertion for method chaining * @throws AssertionError if the distinct size of the collection is less than the specified boundary */ - public SELF hasDistinctSizeGreaterThanOrEqualTo(int boundary) { + public MultimapAssert hasDistinctSizeGreaterThanOrEqualTo(int boundary) { this.isNotNull(); int actualSize = this.actual.sizeDistinct(); if (actualSize >= boundary) { @@ -282,7 +279,7 @@ public SELF hasDistinctSizeGreaterThanOrEqualTo(int boundary) { * @throws NullPointerException if the provided condition is null. * @throws AssertionError if none of the keys in the {@link Multimap} satisfy the given condition. */ - public SELF hasKeySatisfying(Condition keyCondition) { + public MultimapAssert hasKeySatisfying(Condition keyCondition) { this.isNotNull(); requireNonNull(keyCondition, "The condition to evaluate should not be null"); @@ -312,7 +309,7 @@ public SELF hasKeySatisfying(Condition keyCondition) { * @return {@code this} assertion object. * @throws AssertionError if the actual size of the {@link Multimap} is not equal to the expected size. */ - public SELF hasSize(int expected) { + public MultimapAssert hasSize(int expected) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize == expected) { @@ -342,7 +339,7 @@ public SELF hasSize(int expected) { * @return {@code this} assertion object. * @throws AssertionError if the actual size of the {@link Multimap} is not between the given boundaries. */ - public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) { + public MultimapAssert hasSizeBetween(int lowerBoundary, int higherBoundary) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize >= lowerBoundary && actualSize <= higherBoundary) { @@ -370,7 +367,7 @@ public SELF hasSizeBetween(int lowerBoundary, int higherBoundary) { * @return {@code this} assertion object. * @throws AssertionError if the actual size of the {@link Multimap} is not greater than the specified boundary. */ - public SELF hasSizeGreaterThan(int boundary) { + public MultimapAssert hasSizeGreaterThan(int boundary) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize > boundary) { @@ -400,7 +397,7 @@ public SELF hasSizeGreaterThan(int boundary) { * @return {@code this} assertion object for method chaining. * @throws AssertionError if the actual size of the {@link Multimap} is less than the expected size. */ - public SELF hasSizeGreaterThanOrEqualTo(int boundary) { + public MultimapAssert hasSizeGreaterThanOrEqualTo(int boundary) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize >= boundary) { @@ -428,7 +425,7 @@ public SELF hasSizeGreaterThanOrEqualTo(int boundary) { * @return {@code this} assertion object. * @throws AssertionError if the actual size of the {@link Multimap} is not less than the expected size. */ - public SELF hasSizeLessThan(int boundary) { + public MultimapAssert hasSizeLessThan(int boundary) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize < boundary) { @@ -457,7 +454,7 @@ public SELF hasSizeLessThan(int boundary) { * @return {@code this} assertion object for method chaining. * @throws AssertionError if the actual size of the {@link Multimap} is greater than the expected size. */ - public SELF hasSizeLessThanOrEqualTo(int boundary) { + public MultimapAssert hasSizeLessThanOrEqualTo(int boundary) { this.isNotNull(); int actualSize = this.actual.size(); if (actualSize <= boundary) { @@ -474,7 +471,7 @@ public SELF hasSizeLessThanOrEqualTo(int boundary) { * @throws NullPointerException if the provided condition is null. * @throws AssertionError if none of the values in the {@link Multimap} satisfy the given condition. */ - public SELF hasValueSatisfying(Condition valueCondition) { + public MultimapAssert hasValueSatisfying(Condition valueCondition) { this.isNotNull(); requireNonNull(valueCondition, "The condition to evaluate should not be null"); @@ -522,7 +519,7 @@ public void isEmpty() { * @return this assertion object for method chaining * @throws AssertionError if the {@link Multimap} of values is empty. */ - public SELF isNotEmpty() { + public MultimapAssert isNotEmpty() { this.isNotNull(); if (!this.actual.isEmpty()) { return this.myself; diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java deleted file mode 100644 index 24fd687..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.Assertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; -import org.eclipse.collections.api.multimap.bag.BagMultimap; - -/** - * Assertion methods for {@link BagMultimap}s. - *

- * To create an instance of this class, invoke {@link Assertions#assertThat(BagMultimap)}. - *

- * - * @param the type of keys in the BagMultimap. - * @param the type of values in the BagMultimap. - */ -public class BagMultimapAssert extends AbstractMultimapAssert, BagMultimap, KEY, VALUE> { - - /** - * Creates a new instance of {@link BagMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the actual BagMultimap - * @param The type of values in the actual BagMultimap - */ - public static BagMultimapAssert assertThat(BagMultimap actual) { - return new BagMultimapAssert<>(actual); - } - - /** - * Creates a new {@link BagMultimapAssert}. - * @param actual The actual value to assert against - */ - public BagMultimapAssert(BagMultimap actual) { - super(actual, BagMultimapAssert.class); - } -} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java deleted file mode 100644 index e198f0e..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.Assertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; -import org.eclipse.collections.api.multimap.list.ListMultimap; - -/** - * Assertion methods for {@link ListMultimap}s. - *

- * To create an instance of this class, invoke {@link Assertions#assertThat(ListMultimap)}. - *

- * - * @param the type of keys in the ListMultimap. - * @param the type of values in the ListMultimap. - */ -public class ListMultimapAssert - extends AbstractMultimapAssert, ListMultimap, KEY, VALUE> { - - /** - * Creates a new instance of {@link ListMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in th actual ListMultimap - * @param The type of values in the actual ListMultimap - */ - public static ListMultimapAssert assertThat(ListMultimap actual) { - return new ListMultimapAssert<>(actual); - } - - /** - * Creates a new {@link ListMultimapAssert}. - * @param actual The actual value to assert against - */ - public ListMultimapAssert(ListMultimap actual) { - super(actual, ListMultimapAssert.class); - } -} diff --git a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java b/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java deleted file mode 100644 index b6d10bc..0000000 --- a/src/main/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.Assertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert; -import org.eclipse.collections.api.multimap.set.SetMultimap; - -/** - * Assertion methods for {@link SetMultimap}s. - *

- * To create an instance of this class, invoke {@link Assertions#assertThat(SetMultimap)}. - *

- * - * @param the type of keys in the SetMultimap. - * @param the type of values in the SetMultimap. - */ -public class SetMultimapAssert extends AbstractMultimapAssert, SetMultimap, KEY, VALUE> { - - /** - * Creates a new instance of {@link SetMultimapAssert}. - * - * @param actual the actual value. - * @return the created assertion object. - * @param The type of keys in the actual SetMultimap - * @param The type of values in the actual SetMultimap - */ - public static SetMultimapAssert assertThat(SetMultimap actual) { - return new SetMultimapAssert<>(actual); - } - - /** - * Creates a new {@link SetMultimapAssert}. - * @param actual The actual value to assert against - */ - public SetMultimapAssert(SetMultimap actual) { - super(actual, SetMultimapAssert.class); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java deleted file mode 100644 index a979675..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsEntry_Contract.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.eclipse.collections.api.multimap.list.ImmutableListMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_ContainsEntry_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - Pair expectedEntry(); - - Pair missingPair(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passes() { - assertion(testInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo()); - } - - @Test - default void failsEmpty() { - ImmutableListMultimap multimap = Multimaps.immutable.list.empty(); - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())) - .withMessageContaining("Expecting") - .withMessageContaining("to contain") - .withMessageContaining("but could not find the following element(s)"); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsEntry(expectedEntry().getOne(), expectedEntry().getTwo())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java deleted file mode 100644 index 04d8a0b..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsKeys_Contract.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_ContainsKeys_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - KEY[] expectedKeys(); - - KEY missingKey(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passes() { - assertion(testInput()).containsKeys(expectedKeys()); - } - - @Test - default void failsEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).containsKeys(expectedKeys())) - .withMessageContaining("Expecting actual") - .withMessageContaining("{}") - .withMessageContaining("to contain keys"); - } - - @Test - default void failsMissingKey() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsKeys(missingKey())) - .withMessageContaining("Expecting actual") - .withMessageContaining("to contain key") - .withMessageContaining(missingKey().toString()); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).containsKeys(expectedKeys())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsKeys(expectedKeys())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java deleted file mode 100644 index d8dcdc9..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsOnly_Contract.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.eclipse.collections.api.tuple.Pair; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_ContainsOnly_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - Pair[] exactMatchPairs(); - - Map.Entry[] exactMatchEntries(); - - Pair[] partialMatchMissingPairs(); - - Map.Entry[] partialMatchMissingEntries(); - - Pair[] partialMatchExtraPairs(); - - Map.Entry[] partialMatchExtraEntries(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passesWithPairs() { - assertion(testInput()).containsOnly(exactMatchPairs()); - } - - @Test - default void passesWithEntries() { - assertion(testInput()).containsOnly(exactMatchEntries()); - } - - @Test - default void failsWhenAdditionalKeysOrValuesExistWithPair() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchMissingPairs())) - .withMessageContaining("to contain only") - .withMessageContaining("but the following multimap entries were unexpected"); - } - - @Test - default void failsWhenAdditionalKeysOrValuesExistWithEntry() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchMissingEntries())) - .withMessageContaining("to contain only") - .withMessageContaining("but the following multimap entries were unexpected"); - } - - @Test - default void failsWhenEntryIsMissingWithPair() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchExtraPairs())) - .withMessageContaining("to contain only") - .withMessageContaining("but could not find the following multimap entries"); - } - - @Test - default void failsWhenEntryIsMissingWithEntry() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsOnly(partialMatchExtraEntries())) - .withMessageContaining("to contain only") - .withMessageContaining("but could not find the following multimap entries"); - } - - @Test - default void failsForEmptyMultimapWithPair() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).containsOnly(exactMatchPairs())) - .withMessageContaining("to contain only") - .withMessageContaining("but could not find the following multimap entries"); - } - - @Test - default void failsForEmptyMultimapWithEntry() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).containsOnly(exactMatchEntries())) - .withMessageContaining("to contain only") - .withMessageContaining("but could not find the following multimap entries"); - } - - @Test - default void failsForNullMultimapWithPair() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).containsOnly(exactMatchPairs())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsForNullMultimapWithEntry() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).containsOnly(exactMatchEntries())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPassesWithPairs() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsOnly(exactMatchPairs())); - } - - @Test - default void softAssertionPassesWithEntries() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsOnly(exactMatchEntries())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java deleted file mode 100644 index 94fdb43..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_ContainsValues_Contract.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_ContainsValues_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - VALUE[] expectedValues(); - - VALUE missingValue(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passes() { - assertion(testInput()).containsValues(expectedValues()); - } - - @Test - default void failsEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).containsValues(expectedValues())) - .withMessageContaining("Expecting actual") - .withMessageContaining("{}") - .withMessageContaining("to contain values"); - } - - @Test - default void failsMissingKey() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).containsValues(missingValue())) - .withMessageContaining("Expecting actual") - .withMessageContaining("to contain value") - .withMessageContaining(missingValue().toString()); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).containsValues(expectedValues())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).containsValues(expectedValues())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java deleted file mode 100644 index d14e5b7..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_Contains_Contract.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.tuple.Tuples; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_Contains_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - Pair[] expectedPairs(); - - Map.Entry[] expectedEntries(); - - Pair missingPair(); - - Map.Entry missingEntry(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void containsPairsPasses() { - this.assertion(this.testInput()).contains(this.expectedPairs()); - } - - @Test - default void containsPairsFails() { - assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> - this.assertion(this.testInput()).contains(this.missingPair())) - .withMessageContaining("Expecting") - .withMessageContaining("but could not find the following element(s)") - .withMessageContaining(this.missingPair().toString()); - } - - @Test - default void nullActualWithPair() { - assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> - this.assertion(this.nullInput()).contains(this.expectedPairs())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionsWithPairPasses() { - SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()) - .contains(this.expectedPairs())); - } - - @Test - default void containsEntriesPasses() { - this.assertion(this.testInput()).contains(this.expectedEntries()); - } - - @Test - default void containsEntriesFails() { - assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> - this.assertion(this.testInput()).contains(this.missingEntry())) - .withMessageContaining("Expecting") - .withMessageContaining("but could not find the following element(s)") - .withMessageContaining(Tuples.pairFrom(this.missingEntry()).toString()); - } - - @Test - default void nullActualWithEntry() { - assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> - this.assertion(this.nullInput()).contains(this.expectedEntries())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionsWithEntryPasses() { - SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()) - .contains(this.expectedEntries())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java deleted file mode 100644 index c909c9f..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -public interface AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - default I nullInput() { - return null; - } - - @Test - default void passesGreaterThan() { - assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary()); - } - - @Test - default void passesEqual() { - assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(equalsBoundary()); - } - - @Test - default void failsLessThan() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThanOrEqualTo(upperBoundary())) - .withMessageContaining("Expecting distinct size of") - .withMessageContaining(String.format("to be greater than or equal to %s but was %s", upperBoundary(), testInput().sizeDistinct())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsEmptyMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())) - .withMessageContaining(String.format("to be greater than or equal to %s but was 0", lowerBoundary())); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasDistinctSizeGreaterThanOrEqualTo(lowerBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java deleted file mode 100644 index 6623c4c..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passesGreaterThan() { - assertion(testInput()).hasDistinctSizeGreaterThan(lowerBoundary()); - } - - @Test - default void failsLesser() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThan(upperBoundary())) - .withMessageContaining("Expecting distinct size of") - .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary(), testInput().sizeDistinct())); - } - - @Test - default void failsEquals() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasDistinctSizeGreaterThan(equalsBoundary())) - .withMessageContaining("Expecting distinct size of") - .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary(), testInput().sizeDistinct())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasDistinctSizeGreaterThan(lowerBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsEmptyMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasDistinctSizeGreaterThan(lowerBoundary())) - .withMessageContaining(String.format("to be greater than %s but was 0", lowerBoundary())); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasDistinctSizeGreaterThan(lowerBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java deleted file mode 100644 index 25b4ac5..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasDistinctSize_Contract.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasDistinctSize_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testData); - - A softAssertion(SoftAssertions softAssertions, I testData); - - int expectedSize(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passes() { - this.assertion(this.testInput()).hasDistinctSize(this.expectedSize()); - } - - @Test - default void failsEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> this.assertion(this.emptyInput()).hasDistinctSize(this.expectedSize())) - .withMessageContaining(String.format("Expected distinct size: %s but was: 0", this.expectedSize())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> this.assertion(this.nullInput()).hasDistinctSize(this.expectedSize())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()).hasDistinctSize(this.expectedSize())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java deleted file mode 100644 index 72ad842..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasKeySatisfying_Contract.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasKeySatisfying_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - Condition passingCondition(); - - Condition failingCondition(); - - default I nullInput() { - return null; - } - - @Test - default void passesValueSatisfying() { - assertion(testInput()).hasKeySatisfying(passingCondition()); - } - - @Test - default void failsValueNotSatisfying() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasKeySatisfying(failingCondition())) - .withMessageContaining(failingCondition().description().toString()); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasKeySatisfying(passingCondition())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasKeySatisfying(passingCondition())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java deleted file mode 100644 index c085003..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeBetween_Contract.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -import java.util.Objects; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -public interface AbstractMultimapAssert_HasSizeBetween_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - Boundaries withinBoundaries(); - - Boundaries withinBoundariesInclusiveUpper(); - - Boundaries withinBoundariesInclusiveLower(); - - Boundaries belowLowerBoundary(); - - Boundaries aboveUpperBoundary(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passesSizeBetween() { - assertion(testInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary()); - } - - @Test - default void passesSizeBetweenInclusiveUpper() { - assertion(testInput()).hasSizeBetween(withinBoundariesInclusiveUpper().lowerBoundary(), withinBoundariesInclusiveUpper().upperBoundary()); - } - - @Test - default void passesSizeBetweenInclusiveLower() { - assertion(testInput()).hasSizeBetween(withinBoundariesInclusiveLower().lowerBoundary(), withinBoundariesInclusiveLower().upperBoundary()); - } - - @Test - default void failsSizeFallsBelowLowerBoundary() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeBetween(belowLowerBoundary().lowerBoundary(), belowLowerBoundary().upperBoundary())) - .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", belowLowerBoundary().lowerBoundary(), belowLowerBoundary().upperBoundary(), testInput().size())); - } - - @Test - default void failsSizeFallsAboveUpperBoundary() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeBetween(aboveUpperBoundary().lowerBoundary(), aboveUpperBoundary().upperBoundary())) - .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", aboveUpperBoundary().lowerBoundary(), aboveUpperBoundary().upperBoundary(), testInput().size())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsEmptyMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())) - .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary(), emptyInput().size())); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeBetween(withinBoundaries().lowerBoundary(), withinBoundaries().upperBoundary())); - } - - final class Boundaries { - private final int lowerBoundary; - private final int upperBoundary; - - public Boundaries(int lowerBoundary, int upperBoundary) { - this.lowerBoundary = lowerBoundary; - this.upperBoundary = upperBoundary; - } - - public int lowerBoundary() { - return lowerBoundary; - } - - public int upperBoundary() { - return upperBoundary; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Boundaries)) return false; - Boundaries that = (Boundaries) o; - return lowerBoundary == that.lowerBoundary && upperBoundary == that.upperBoundary; - } - - @Override - public int hashCode() { - return Objects.hash(lowerBoundary, upperBoundary); - } - - @Override - public String toString() { - return lowerBoundary + ".." + upperBoundary; - } - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java deleted file mode 100644 index 3a07301..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -public interface AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - default I nullInput() { - return null; - } - - @Test - default void passesGreaterThan() { - assertion(testInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary()); - } - - @Test - default void passesEqual() { - assertion(testInput()).hasSizeGreaterThanOrEqualTo(equalsBoundary()); - } - - @Test - default void failsLessThan() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThanOrEqualTo(upperBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be greater than or equal to %s but was %s", upperBoundary(), testInput().size())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsEmptyMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())) - .withMessageContaining(String.format("to be greater than or equal to %s but was 0", lowerBoundary())); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeGreaterThanOrEqualTo(lowerBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java deleted file mode 100644 index 4d8ff14..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeGreaterThan_Contract.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -public interface AbstractMultimapAssert_HasSizeGreaterThan_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passesGreaterThan() { - assertion(testInput()).hasSizeGreaterThan(lowerBoundary()); - } - - @Test - default void failsLesser() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThan(upperBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary(), testInput().size())); - } - - @Test - default void failsEquals() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeGreaterThan(equalsBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary(), testInput().size())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasSizeGreaterThan(upperBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void failsEmptyMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).hasSizeGreaterThan(lowerBoundary())) - .withMessageContaining(String.format("to be greater than %s but was 0", lowerBoundary())); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeGreaterThan(lowerBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java deleted file mode 100644 index 2cf7cf0..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - default I nullInput() { - return null; - } - - @Test - default void passesLessThan() { - assertion(testInput()).hasSizeLessThanOrEqualTo(upperBoundary()); - } - - @Test - default void passesEqual() { - assertion(testInput()).hasSizeLessThanOrEqualTo(equalsBoundary()); - } - - @Test - default void failsGreater() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeLessThanOrEqualTo(lowerBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be less than or equal to %s but was %s", lowerBoundary(), testInput().size())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasSizeLessThanOrEqualTo(upperBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeLessThanOrEqualTo(upperBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java deleted file mode 100644 index 773200c..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSizeLessThan_Contract.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasSizeLessThan_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - int upperBoundary(); - - int lowerBoundary(); - - int equalsBoundary(); - - default I nullInput() { - return null; - } - - @Test - default void passesLessThan() { - assertion(testInput()).hasSizeLessThan(upperBoundary()); - } - - @Test - default void failsGreater() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeLessThan(lowerBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be less than %s but was %s", lowerBoundary(), testInput().size())); - } - - @Test - default void failsEquals() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasSizeLessThan(equalsBoundary())) - .withMessageContaining("Expecting size of") - .withMessageContaining(String.format("to be less than %s but was %s", equalsBoundary(), testInput().size())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasSizeLessThan(upperBoundary())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasSizeLessThan(upperBoundary())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java deleted file mode 100644 index ac01032..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasSize_Contract.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasSize_Contract, A extends AbstractMultimapAssert> { - I testInput(); - - I emptyInput(); - - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - int expectedSize(); - - /** - * Test data input that always returns null. Used for testing how assertions handle null. - */ - default I nullInput() { - return null; - } - - @Test - default void passes() { - this.assertion(this.testInput()).hasSize(this.expectedSize()); - } - - @Test - default void failsEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> this.assertion(this.emptyInput()).hasSize(this.expectedSize())) - .withMessageContaining(String.format("Expected size: %s but was: 0", this.expectedSize())); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> this.assertion(this.nullInput()).hasSize(this.expectedSize())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> this.softAssertion(softly, this.testInput()).hasSize(this.expectedSize())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java deleted file mode 100644 index 4e3a9d9..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_HasValueSatisfying_Contract.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_HasValueSatisfying_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - Condition passingCondition(); - - Condition failingCondition(); - - default I nullInput() { - return null; - } - - @Test - default void passesValueSatisfying() { - assertion(testInput()).hasValueSatisfying(passingCondition()); - } - - @Test - default void failsValueNotSatisfying() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).hasValueSatisfying(failingCondition())) - .withMessageContaining(failingCondition().description().toString()); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).hasValueSatisfying(passingCondition())) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).hasValueSatisfying(passingCondition())); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java deleted file mode 100644 index 2b11f9a..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsEmpty_Contract.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_IsEmpty_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - default I nullInput() { - return null; - } - - @Test - default void passes() { - assertion(emptyInput()).isEmpty(); - } - - @Test - default void failsNotEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).isEmpty()) - .withMessageContaining("Expecting empty but was: " + testInput().toString()); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).isEmpty()) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, emptyInput()).isEmpty()); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java deleted file mode 100644 index 007c560..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNotEmpty_Contract.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_IsNotEmpty_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - default I nullInput() { - return null; - } - - @Test - default void passesNotEmpty() { - assertion(testInput()).isNotEmpty(); - } - - @Test - default void failsEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(emptyInput()).isNotEmpty()) - .withMessageContaining("Expecting actual not to be empty"); - } - - @Test - default void failsNullMultimap() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(nullInput()).isNotEmpty()) - .withMessageContaining("Expecting actual not to be null"); - } - - @Test - default void softAssertionPasses() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, testInput()).isNotEmpty()); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java deleted file mode 100644 index 869e403..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert_IsNullOrEmpty_Contract.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.eclipse.collections.api.multimap.Multimap; -import org.junit.jupiter.api.Test; - -public interface AbstractMultimapAssert_IsNullOrEmpty_Contract, A extends AbstractMultimapAssert> { - A assertion(I testInput); - - A softAssertion(SoftAssertions softAssertions, I testInput); - - I testInput(); - - I emptyInput(); - - default I nullInput() { - return null; - } - - @Test - default void passesEmptyMultimap() { - assertion(emptyInput()).isNullOrEmpty(); - } - - @Test - default void passesNullMultimap() { - assertion(nullInput()).isNullOrEmpty(); - } - - @Test - default void failsNotNullOrEmpty() { - assertThatExceptionOfType(AssertionError.class) - .isThrownBy(() -> assertion(testInput()).isNullOrEmpty()) - .withMessageContaining("Expecting null or empty but was: " + testInput().toString()); - } - - @Test - default void softAssertionPassesEmpty() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, emptyInput()).isNullOrEmpty()); - } - - @Test - default void softAssertionPassesNullMultimap() { - SoftAssertions.assertSoftly(softly -> softAssertion(softly, nullInput()).isNullOrEmpty()); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsEntry_Test.java new file mode 100644 index 0000000..9bf2ac7 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsEntry_Test.java @@ -0,0 +1,67 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.factory.Multimaps; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_ContainsEntry_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void passes(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).containsEntry("ENT", "Reed")); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsEntry("ENT", "Reed")) + .withMessageContaining("Expecting") + .withMessageContaining("to contain") + .withMessageContaining("but could not find the following element(s)"); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).containsEntry("ENT", "Reed")) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsMissingEntry(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsEntry("VOY", "Kes")) + .withMessageContaining("Expecting") + .withMessageContaining("to contain") + .withMessageContaining("but could not find the following element(s)"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void softAssertionPasses(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).containsEntry("ENT", "Reed")); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsKeys_Test.java new file mode 100644 index 0000000..7bf5aa8 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsKeys_Test.java @@ -0,0 +1,64 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_ContainsKeys_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void passes(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).containsKeys("TOS", "TNG", "DS9")); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsKeys("TOS", "TNG", "DS9")) + .withMessageContaining("Expecting actual") + .withMessageContaining("{}") + .withMessageContaining("to contain keys"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsMissingKey(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsKeys("DIS")) + .withMessageContaining("Expecting actual") + .withMessageContaining("to contain key") + .withMessageContaining("DIS"); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).containsKeys("TOS", "TNG", "DS9")) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void softAssertionPasses(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).containsKeys("TOS", "TNG", "DS9")); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsOnly_Test.java new file mode 100644 index 0000000..0e98b72 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsOnly_Test.java @@ -0,0 +1,185 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.eclipse.collections.impl.tuple.Tuples.pair; + +import java.util.Map; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_ContainsOnly_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void passesWithPairs(Multimap actual) { + Pair[] exactMatchPairs = new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(exactMatchPairs)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void passesWithEntries(Multimap actual) { + Map.Entry[] exactMatchEntries = new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(exactMatchEntries)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void failsWhenAdditionalKeysOrValuesExistWithPair(Multimap actual) { + Pair[] partialMatchMissingPairs = new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(partialMatchMissingPairs)) + .withMessageContaining("to contain only") + .withMessageContaining("but the following multimap entries were unexpected"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void failsWhenAdditionalKeysOrValuesExistWithEntry(Multimap actual) { + Map.Entry[] partialMatchMissingEntries = new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(partialMatchMissingEntries)) + .withMessageContaining("to contain only") + .withMessageContaining("but the following multimap entries were unexpected"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void failsWhenEntryIsMissingWithPair(Multimap actual) { + Pair[] partialMatchExtraPairs = new Pair[]{ + pair("TOS", "Enterprise"), + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(partialMatchExtraPairs)) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void failsWhenEntryIsMissingWithEntry(Multimap actual) { + Map.Entry[] partialMatchExtraEntries = new Map.Entry[]{ + pair("TOS", "Enterprise").toEntry(), + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(partialMatchExtraEntries)) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsForEmptyMultimapWithPair(Multimap actual) { + Pair[] exactMatchPairs = new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine") + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(exactMatchPairs)) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsForEmptyMultimapWithEntry(Multimap actual) { + Map.Entry[] exactMatchEntries = new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry() + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsOnly(exactMatchEntries)) + .withMessageContaining("to contain only") + .withMessageContaining("but could not find the following multimap entries"); + } + + @Test + void failsForNullMultimapWithPair() { + Pair[] exactMatchPairs = new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine") + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).containsOnly(exactMatchPairs)) + .withMessageContaining("Expecting actual not to be null"); + } + + @Test + void failsForNullMultimapWithEntry() { + Map.Entry[] exactMatchEntries = new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry() + }; + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).containsOnly(exactMatchEntries)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void softAssertionPassesWithPairs(Multimap actual) { + Pair[] exactMatchPairs = new Pair[]{ + pair("TNG", "Enterprise"), + pair("DS9", "Deep Space Nine"), + pair("DS9", "Defiant"), + pair("VOY", "Voyager") + }; + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).containsOnly(exactMatchPairs)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#shipMultimaps") + void softAssertionPassesWithEntries(Multimap actual) { + Map.Entry[] exactMatchEntries = new Map.Entry[]{ + pair("TNG", "Enterprise").toEntry(), + pair("DS9", "Deep Space Nine").toEntry(), + pair("DS9", "Defiant").toEntry(), + pair("VOY", "Voyager").toEntry() + }; + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).containsOnly(exactMatchEntries)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsValues_Test.java new file mode 100644 index 0000000..9a50f29 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_ContainsValues_Test.java @@ -0,0 +1,64 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_ContainsValues_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void passes(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).containsValues("Kirk", "Picard", "Sisko", "Janeway", "Archer")); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsValues("Kirk", "Picard", "Sisko", "Janeway", "Archer")) + .withMessageContaining("Expecting actual") + .withMessageContaining("{}") + .withMessageContaining("to contain values"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsMissingValue(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).containsValues("Kes")) + .withMessageContaining("Expecting actual") + .withMessageContaining("to contain value") + .withMessageContaining("Kes"); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).containsValues("Kirk", "Picard", "Sisko", "Janeway", "Archer")) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void softAssertionPasses(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).containsValues("Kirk", "Picard", "Sisko", "Janeway", "Archer")); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_Contains_Test.java new file mode 100644 index 0000000..789cdd8 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_Contains_Test.java @@ -0,0 +1,123 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.eclipse.collections.impl.tuple.Tuples.pair; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +import java.util.Map; +import java.util.stream.Stream; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.api.tuple.Pair; +import org.eclipse.collections.impl.tuple.Tuples; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_Contains_Test { + + @ParameterizedTest + @MethodSource("successfulPairTestCases") + void containsPairsPasses(Multimap actual, Pair[] expectedPairs) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).contains(expectedPairs)); + } + + @ParameterizedTest + @MethodSource("missingPairTestCases") + void containsPairsFails(Multimap actual, Pair missingPair) { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + new MultimapAssert<>(actual).contains(missingPair)) + .withMessageContaining("Expecting") + .withMessageContaining("but could not find the following element(s)") + .withMessageContaining(missingPair.toString()); + } + + @Test + void nullActualWithPair() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + new MultimapAssert<>(null).contains(pair("TOS", "McCoy"))) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("successfulPairTestCases") + void softAssertionsWithPairPasses(Multimap actual, Pair[] expectedPairs) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).contains(expectedPairs)); + } + + @ParameterizedTest + @MethodSource("successfulMapEntryTestCases") + void containsEntriesPasses(Multimap actual, Map.Entry[] expectedEntries) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).contains(expectedEntries)); + } + + @ParameterizedTest + @MethodSource("missingMapEntryTestCases") + void containsEntriesFails(Multimap actual, Map.Entry missingEntry) { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + new MultimapAssert<>(actual).contains(missingEntry)) + .withMessageContaining("Expecting") + .withMessageContaining("but could not find the following element(s)") + .withMessageContaining(Tuples.pairFrom(missingEntry).toString()); + } + + @Test + void nullActualWithEntry() { + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> + new MultimapAssert<>(null).contains((Map.Entry) pair("TOS", "McCoy").toEntry())) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("successfulMapEntryTestCases") + void softAssertionsWithEntryPasses(Multimap actual, Map.Entry[] expectedEntries) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).contains(expectedEntries)); + } + + private static Stream successfulPairTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), new Pair[]{pair("TOS", "McCoy"), pair("TNG", "Crusher")}), + arguments(MultimapTestData.mutableListMultimap(), new Pair[]{pair("TOS", "McCoy"), pair("TNG", "Crusher")}), + arguments(MultimapTestData.mutableSetMultimap(), new Pair[]{pair("TOS", "McCoy"), pair("TNG", "Crusher")}) + ); + } + + private static Stream successfulMapEntryTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), new Map.Entry[]{pair("TOS", "McCoy").toEntry(), pair("TNG", "Crusher").toEntry()}), + arguments(MultimapTestData.mutableListMultimap(), new Map.Entry[]{pair("TOS", "McCoy").toEntry(), pair("TNG", "Crusher").toEntry()}), + arguments(MultimapTestData.mutableSetMultimap(), new Map.Entry[]{pair("TOS", "McCoy").toEntry(), pair("TNG", "Crusher").toEntry()}) + ); + } + + private static Stream missingPairTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), pair("VOY", "Kes")), + arguments(MultimapTestData.mutableListMultimap(), pair("VOY", "Kes")), + arguments(MultimapTestData.mutableSetMultimap(), pair("VOY", "Kes")) + ); + } + + private static Stream missingMapEntryTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), pair("VOY", "Kes").toEntry()), + arguments(MultimapTestData.mutableListMultimap(), pair("VOY", "Kes").toEntry()), + arguments(MultimapTestData.mutableSetMultimap(), pair("VOY", "Kes").toEntry()) + ); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSizeGreaterThan_Test.java new file mode 100644 index 0000000..deda665 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSizeGreaterThan_Test.java @@ -0,0 +1,73 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.eclipse.collections.impl.factory.Multimaps; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasDistinctSizeGreaterThan_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeLowerBoundaryTestData") + void passesGreaterThan(Multimap actual, int lowerBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSizeGreaterThan(lowerBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeUpperBoundaryTestData") + void failsLesser(Multimap actual, int upperBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSizeGreaterThan(upperBoundary)) + .withMessageContaining("Expecting distinct size of") + .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary, actual.sizeDistinct())); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeEqualsTestData") + void failsEquals(Multimap actual, int equalsBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSizeGreaterThan(equalsBoundary)) + .withMessageContaining("Expecting distinct size of") + .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary, actual.sizeDistinct())); + } + + @Test + void failsNullMultimap() { + int lowerBoundary = 2; // Using the same value as in distinctSizeLowerBoundaryTestData + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasDistinctSizeGreaterThan(lowerBoundary)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmptyMultimap(Multimap actual) { + int lowerBoundary = 2; // Using the same value as in distinctSizeLowerBoundaryTestData + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSizeGreaterThan(lowerBoundary)) + .withMessageContaining(String.format("to be greater than %s but was 0", lowerBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeLowerBoundaryTestData") + void softAssertionPasses(Multimap actual, int lowerBoundary) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasDistinctSizeGreaterThan(lowerBoundary)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSize_Test.java new file mode 100644 index 0000000..2769111 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasDistinctSize_Test.java @@ -0,0 +1,53 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasDistinctSize_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeEqualsTestData") + void passes(Multimap actual, int expectedSize) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSize(expectedSize)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimapsWithExpectedDistinctSize") + void failsEmpty(Multimap actual, int expectedSize) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasDistinctSize(expectedSize)) + .withMessageContaining(String.format("Expected distinct size: %s but was: 0", expectedSize)); + } + + @Test + void failsNullMultimap() { + int expectedSize = 5; // Using the same value as in distinctSizeEqualsTestData + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasDistinctSize(expectedSize)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#distinctSizeEqualsTestData") + void softAssertionPasses(Multimap actual, int expectedSize) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasDistinctSize(expectedSize)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java new file mode 100644 index 0000000..b36e769 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java @@ -0,0 +1,56 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasKeySatisfying_Test { + + private static final Condition PASSING_CONDITION = new Condition<>(value -> "DS9".equals(value), "key equals DS9"); + private static final Condition FAILING_CONDITION = new Condition<>(value -> "DIS".equals(value), "key equals DIS"); + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void passesKeySatisfying(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasKeySatisfying(PASSING_CONDITION)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsKeyNotSatisfying(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasKeySatisfying(FAILING_CONDITION)) + .withMessageContaining(FAILING_CONDITION.description().toString()); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasKeySatisfying(PASSING_CONDITION)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void softAssertionPasses(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasKeySatisfying(PASSING_CONDITION)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeBetween_Test.java new file mode 100644 index 0000000..1789114 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeBetween_Test.java @@ -0,0 +1,80 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasSizeBetween_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeBetweenTestData") + void passesSizeBetween(Multimap actual, int lowerBoundary, int upperBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(lowerBoundary, upperBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeBetweenInclusiveUpperTestData") + void passesSizeBetweenInclusiveUpper(Multimap actual, int lowerBoundary, int upperBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(lowerBoundary, upperBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeBetweenInclusiveLowerTestData") + void passesSizeBetweenInclusiveLower(Multimap actual, int lowerBoundary, int upperBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(lowerBoundary, upperBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeBelowLowerBoundaryTestData") + void failsSizeFallsBelowLowerBoundary(Multimap actual, int lowerBoundary, int upperBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(lowerBoundary, upperBoundary)) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", lowerBoundary, upperBoundary, actual.size())); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeAboveUpperBoundaryTestData") + void failsSizeFallsAboveUpperBoundary(Multimap actual, int lowerBoundary, int upperBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(lowerBoundary, upperBoundary)) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", lowerBoundary, upperBoundary, actual.size())); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasSizeBetween(25, 50)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmptyMultimap(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeBetween(25, 50)) + .withMessageContaining(String.format("Expected size to be between: %s and %s but was: %s", 25, 50, actual.size())); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeBetweenTestData") + void softAssertionPasses(Multimap actual, int lowerBoundary, int upperBoundary) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasSizeBetween(lowerBoundary, upperBoundary)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeGreaterThan_Test.java new file mode 100644 index 0000000..944656e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeGreaterThan_Test.java @@ -0,0 +1,70 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasSizeGreaterThan_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeLowerBoundaryTestData") + void passesGreaterThan(Multimap actual, int lowerBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeGreaterThan(lowerBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeUpperBoundaryTestData") + void failsLesser(Multimap actual, int upperBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeGreaterThan(upperBoundary)) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be greater than %s but was %s", upperBoundary, actual.size())); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeEqualsTestData") + void failsEquals(Multimap actual, int equalsBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeGreaterThan(equalsBoundary)) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be greater than %s but was %s", equalsBoundary, actual.size())); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasSizeGreaterThan(50)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmptyMultimap(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeGreaterThan(5)) + .withMessageContaining(String.format("to be greater than %s but was 0", 5)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeLowerBoundaryTestData") + void softAssertionPasses(Multimap actual, int lowerBoundary) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasSizeGreaterThan(lowerBoundary)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThanOrEqualTo_Test.java new file mode 100644 index 0000000..3b29ade --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThanOrEqualTo_Test.java @@ -0,0 +1,59 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasSizeLessThanOrEqualTo_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeUpperBoundaryTestData") + void passesLessThan(Multimap actual, int upperBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThanOrEqualTo(upperBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeEqualsTestData") + void passesEqual(Multimap actual, int equalsBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThanOrEqualTo(equalsBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeLowerBoundaryTestData") + void failsGreater(Multimap actual, int lowerBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThanOrEqualTo(lowerBoundary)) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than or equal to %s but was %s", lowerBoundary, actual.size())); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasSizeLessThanOrEqualTo(42)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeUpperBoundaryTestData") + void softAssertionPasses(Multimap actual, int upperBoundary) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasSizeLessThanOrEqualTo(upperBoundary)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThan_Test.java new file mode 100644 index 0000000..72a1113 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSizeLessThan_Test.java @@ -0,0 +1,62 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasSizeLessThan_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeUpperBoundaryTestData") + void passesLessThan(Multimap actual, int upperBoundary) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThan(upperBoundary)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeLowerBoundaryTestData") + void failsGreater(Multimap actual, int lowerBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThan(lowerBoundary)) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than %s but was %s", lowerBoundary, actual.size())); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeEqualsTestData") + void failsEquals(Multimap actual, int equalsBoundary) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSizeLessThan(equalsBoundary)) + .withMessageContaining("Expecting size of") + .withMessageContaining(String.format("to be less than %s but was %s", equalsBoundary, actual.size())); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasSizeLessThan(50)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeUpperBoundaryTestData") + void softAssertionPasses(Multimap actual, int upperBoundary) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasSizeLessThan(upperBoundary)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSize_Test.java new file mode 100644 index 0000000..fa164c1 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasSize_Test.java @@ -0,0 +1,52 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasSize_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeEqualsTestData") + void passes(Multimap actual, int expectedSize) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasSize(expectedSize)); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimapsWithExpectedSize") + void failsEmpty(Multimap actual, int expectedSize) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasSize(expectedSize)) + .withMessageContaining(String.format("Expected size: %s but was: 0", expectedSize)); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).hasSize(38)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#sizeEqualsTestData") + void softAssertionPasses(Multimap actual, int expectedSize) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasSize(expectedSize)); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasValueSatisfying_Test.java new file mode 100644 index 0000000..a9731b9 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasValueSatisfying_Test.java @@ -0,0 +1,73 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +import java.util.stream.Stream; + +import org.assertj.core.api.Condition; +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_HasValueSatisfying_Test { + + @ParameterizedTest + @MethodSource("successfulConditionTestCases") + void passesValueSatisfying(Multimap actual, Condition condition) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).hasValueSatisfying(condition)); + } + + @ParameterizedTest + @MethodSource("failureConditionTestCases") + void failsValueNotSatisfying(Multimap actual, Condition condition) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).hasValueSatisfying(condition)) + .withMessageContaining(condition.description().toString()); + } + + @ParameterizedTest + @MethodSource("successfulConditionTestCases") + void failsNullMultimap(Multimap ignored, Condition condition) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>((Multimap) null).hasValueSatisfying(condition)) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("successfulConditionTestCases") + void softAssertionPasses(Multimap actual, Condition condition) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).hasValueSatisfying(condition)); + } + + private static Stream successfulConditionTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), new Condition<>(value -> value.equals("Janeway"), "value equals Janeway")), + arguments(MultimapTestData.mutableListMultimap(), new Condition<>(value -> value.equals("Janeway"), "value equals Janeway")), + arguments(MultimapTestData.mutableSetMultimap(), new Condition<>(value -> value.equals("Janeway"), "value equals Janeway")) + ); + } + + private static Stream failureConditionTestCases() { + return Stream.of( + arguments(MultimapTestData.mutableBagMultimap(), new Condition<>(value -> value.equals("Kes"), "value equals Kes")), + arguments(MultimapTestData.mutableListMultimap(), new Condition<>(value -> value.equals("Kes"), "value equals Kes")), + arguments(MultimapTestData.mutableSetMultimap(), new Condition<>(value -> value.equals("Kes"), "value equals Kes")) + ); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsEmpty_Test.java new file mode 100644 index 0000000..f0263b1 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsEmpty_Test.java @@ -0,0 +1,53 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_IsEmpty_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void passes(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).isEmpty()); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsNotEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).isEmpty()) + .withMessageContaining("Expecting empty but was: " + actual.toString()); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).isEmpty()) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void softAssertionPasses(Multimap actual) { + assertThatNoException().isThrownBy(() -> + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).isEmpty())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNotEmpty_Test.java new file mode 100644 index 0000000..6fb891e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNotEmpty_Test.java @@ -0,0 +1,56 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.junit.jupiter.params.provider.Arguments.arguments; + +import java.util.stream.Stream; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_IsNotEmpty_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void passesNotEmpty(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).isNotEmpty()); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void failsEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).isNotEmpty()) + .withMessageContaining("Expecting actual not to be empty"); + } + + @Test + void failsNullMultimap() { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(null).isNotEmpty()) + .withMessageContaining("Expecting actual not to be null"); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void softAssertionPasses(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).isNotEmpty()); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNullOrEmpty_Test.java new file mode 100644 index 0000000..f94b81e --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_IsNullOrEmpty_Test.java @@ -0,0 +1,55 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + +import org.assertj.eclipse.collections.api.SoftAssertions; +import org.eclipse.collections.api.multimap.Multimap; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +class MultimapAssert_IsNullOrEmpty_Test { + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void passesEmptyMultimap(Multimap actual) { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(actual).isNullOrEmpty()); + } + + @Test + void passesNullMultimap() { + assertThatNoException().isThrownBy(() -> new MultimapAssert<>(null).isNullOrEmpty()); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") + void failsNotNullOrEmpty(Multimap actual) { + assertThatExceptionOfType(AssertionError.class) + .isThrownBy(() -> new MultimapAssert<>(actual).isNullOrEmpty()) + .withMessageContaining("Expecting null or empty but was: " + actual.toString()); + } + + @ParameterizedTest + @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#emptyMultimaps") + void softAssertionPassesEmpty(Multimap actual) { + SoftAssertions.assertSoftly(softly -> softly.assertThat(actual).isNullOrEmpty()); + } + + @Test + void softAssertionPassesNullMultimap() { + assertThatNoException().isThrownBy(() -> SoftAssertions.assertSoftly(softly -> softly.assertThat(null).isNullOrEmpty())); + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapTestData.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapTestData.java new file mode 100644 index 0000000..dc00d73 --- /dev/null +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapTestData.java @@ -0,0 +1,216 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * 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 2025-2025 the original author or authors. + */ +package org.assertj.eclipse.collections.api.multimap; + +import org.eclipse.collections.api.factory.Bags; +import org.eclipse.collections.api.factory.Lists; +import org.eclipse.collections.api.factory.Sets; +import org.eclipse.collections.api.multimap.bag.BagMultimap; +import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; +import org.eclipse.collections.api.multimap.list.ListMultimap; +import org.eclipse.collections.api.multimap.list.MutableListMultimap; +import org.eclipse.collections.api.multimap.set.MutableSetMultimap; +import org.eclipse.collections.api.multimap.set.SetMultimap; +import org.eclipse.collections.impl.factory.Multimaps; +import org.junit.jupiter.params.provider.Arguments; + +import java.util.stream.Stream; + +import static org.junit.jupiter.params.provider.Arguments.arguments; + +class MultimapTestData { + public static Stream emptyMultimaps() { + return Stream.of( + arguments(Multimaps.mutable.bag.empty()), + arguments(Multimaps.mutable.list.empty()), + arguments(Multimaps.mutable.set.empty()) + ); + } + + public static Stream nonEmptyMultimaps() { + return Stream.of( + arguments(mutableBagMultimap()), + arguments(mutableListMultimap()), + arguments(mutableSetMultimap()) + ); + } + + public static Stream sizeUpperBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 50), + arguments(mutableListMultimap(), 50), + arguments(mutableSetMultimap(), 50) + ); + } + + public static Stream sizeLowerBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 5), + arguments(mutableListMultimap(), 5), + arguments(mutableSetMultimap(), 5) + ); + } + + public static Stream sizeEqualsTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 38), + arguments(mutableListMultimap(), 38), + arguments(mutableSetMultimap(), 38) + ); + } + + public static Stream sizeBetweenTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 25, 50), + arguments(mutableListMultimap(), 25, 50), + arguments(mutableSetMultimap(), 25, 50) + ); + } + + public static Stream sizeBetweenInclusiveUpperTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 25, 38), + arguments(mutableListMultimap(), 25, 38), + arguments(mutableSetMultimap(), 25, 38) + ); + } + + public static Stream sizeBetweenInclusiveLowerTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 38, 50), + arguments(mutableListMultimap(), 38, 50), + arguments(mutableSetMultimap(), 38, 50) + ); + } + + public static Stream sizeBelowLowerBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 50, 57), + arguments(mutableListMultimap(), 50, 57), + arguments(mutableSetMultimap(), 50, 57) + ); + } + + public static Stream sizeAboveUpperBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 25, 32), + arguments(mutableListMultimap(), 25, 32), + arguments(mutableSetMultimap(), 25, 32) + ); + } + + public static Stream emptyMultimapsWithExpectedSize() { + return Stream.of( + arguments(Multimaps.mutable.bag.empty(), 38), + arguments(Multimaps.mutable.list.empty(), 38), + arguments(Multimaps.mutable.set.empty(), 38) + ); + } + + public static Stream distinctSizeEqualsTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 5), + arguments(mutableListMultimap(), 5), + arguments(mutableSetMultimap(), 5) + ); + } + + public static Stream emptyMultimapsWithExpectedDistinctSize() { + return Stream.of( + arguments(Multimaps.mutable.bag.empty(), 5), + arguments(Multimaps.mutable.list.empty(), 5), + arguments(Multimaps.mutable.set.empty(), 5) + ); + } + + public static Stream distinctSizeLowerBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 2), + arguments(mutableListMultimap(), 2), + arguments(mutableSetMultimap(), 2) + ); + } + + public static Stream distinctSizeUpperBoundaryTestData() { + return Stream.of( + arguments(mutableBagMultimap(), 10), + arguments(mutableListMultimap(), 10), + arguments(mutableSetMultimap(), 10) + ); + } + + public static BagMultimap mutableBagMultimap() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + public static ListMultimap mutableListMultimap() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + public static SetMultimap mutableSetMultimap() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); + multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); + multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); + multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); + multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); + return multimap; + } + + public static Stream shipMultimaps() { + return Stream.of( + arguments(mutableBagShipMultimap()), + arguments(mutableListShipMultimap()), + arguments(mutableSetShipMultimap()) + ); + } + + public static BagMultimap mutableBagShipMultimap() { + MutableBagMultimap multimap = Multimaps.mutable.bag.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } + + public static ListMultimap mutableListShipMultimap() { + MutableListMultimap multimap = Multimaps.mutable.list.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } + + public static SetMultimap mutableSetShipMultimap() { + MutableSetMultimap multimap = Multimaps.mutable.set.of(); + multimap.put("TNG", "Enterprise"); + multimap.put("DS9", "Deep Space Nine"); + multimap.put("DS9", "Defiant"); + multimap.put("VOY", "Voyager"); + return multimap; + } +} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java deleted file mode 100644 index 0675e87..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsEntry_Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; -import org.eclipse.collections.impl.tuple.Tuples; - -class BagMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair expectedEntry() { - return Tuples.pair("ENT", "Reed"); - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java deleted file mode 100644 index b9453a7..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsKeys_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedKeys() { - return new String[]{"TOS", "TNG", "DS9"}; - } - - @Override - public String missingKey() { - return "DIS"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java deleted file mode 100644 index a59538e..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsOnly_Test.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, BagMultimapAssert> { - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.put("TNG", "Enterprise"); - multimap.put("DS9", "Deep Space Nine"); - multimap.put("DS9", "Defiant"); - multimap.put("VOY", "Voyager"); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] exactMatchPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] exactMatchEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchMissingPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchMissingEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchExtraPairs() { - return new Pair[]{ - pair("TOS", "Enterprise"), - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchExtraEntries() { - return new Map.Entry[]{ - pair("TOS", "Enterprise").toEntry(), - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java deleted file mode 100644 index 0056487..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_ContainsValues_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedValues() { - return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; - } - - @Override - public String missingValue() { - return "Kes"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java deleted file mode 100644 index c73ee7b..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_Contains_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] expectedPairs() { - return new Pair[]{pair("TOS", "McCoy"), pair("TNG", "Crusher")}; - } - - @Override - public Map.Entry[] expectedEntries() { - return new Map.Entry[]{pair("TOS", "McCoy").toEntry(), pair("TNG", "Crusher").toEntry()}; - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } - - @Override - public Map.Entry missingEntry() { - return missingPair().toEntry(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index 8a14237..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java deleted file mode 100644 index 979e9f8..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java deleted file mode 100644 index 6d5bda8..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasDistinctSize_Test.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testData) { - return BagMultimapAssert.assertThat(testData); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testData) { - return softAssertions.assertThat(testData); - } - - @Override - public int expectedSize() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java deleted file mode 100644 index d95fe8d..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasKeySatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java deleted file mode 100644 index 5a3713c..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeBetween_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Boundaries withinBoundaries() { - return new Boundaries(25, 50); - } - - @Override - public Boundaries withinBoundariesInclusiveUpper() { - return new Boundaries(25, 38); - } - - @Override - public Boundaries withinBoundariesInclusiveLower() { - return new Boundaries(38, 50); - } - - @Override - public Boundaries belowLowerBoundary() { - return new Boundaries(50, 57); - } - - @Override - public Boundaries aboveUpperBoundary() { - return new Boundaries(25, 32); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index b5bac3f..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat( testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java deleted file mode 100644 index d469efd..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java deleted file mode 100644 index afb8afb..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java deleted file mode 100644 index 764a42a..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSizeLessThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java deleted file mode 100644 index bc37c78..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasSize_Test.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, BagMultimapAssert> { - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int expectedSize() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java deleted file mode 100644 index 9663d39..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_HasValueSatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java deleted file mode 100644 index 7f59444..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsEmpty_Test.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java deleted file mode 100644 index f5b063f..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNotEmpty_Test.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class BagMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java deleted file mode 100644 index 5dd1f55..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert_IsNullOrEmpty_Test.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.bag; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.bag.BagMultimapAssert; -import org.eclipse.collections.api.factory.Bags; -import org.eclipse.collections.api.multimap.bag.BagMultimap; -import org.eclipse.collections.api.multimap.bag.MutableBagMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class BagMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, BagMultimapAssert> { - @Override - public BagMultimapAssert assertion(BagMultimap testInput) { - return BagMultimapAssert.assertThat(testInput); - } - - @Override - public BagMultimapAssert softAssertion(SoftAssertions softAssertions, BagMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public BagMultimap testInput() { - MutableBagMultimap multimap = Multimaps.mutable.bag.of(); - multimap.putAll("TOS", Bags.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Bags.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Bags.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Bags.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Bags.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public BagMultimap emptyInput() { - return Multimaps.immutable.bag.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java deleted file mode 100644 index 8722c16..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsEntry_Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; -import org.eclipse.collections.impl.tuple.Tuples; - -class ListMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.empty(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair expectedEntry() { - return Tuples.pair("ENT", "Reed"); - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java deleted file mode 100644 index 3b4c8ff..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsKeys_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedKeys() { - return new String[]{"TOS", "TNG", "DS9"}; - } - - @Override - public String missingKey() { - return "DIS"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java deleted file mode 100644 index b994bff..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsOnly_Test.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, ListMultimapAssert> { - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.put("TNG", "Enterprise"); - multimap.put("DS9", "Deep Space Nine"); - multimap.put("DS9", "Defiant"); - multimap.put("VOY", "Voyager"); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] exactMatchPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] exactMatchEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchMissingPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchMissingEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchExtraPairs() { - return new Pair[]{ - pair("TOS", "Enterprise"), - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchExtraEntries() { - return new Map.Entry[]{ - pair("TOS", "Enterprise").toEntry(), - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java deleted file mode 100644 index dfade62..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_ContainsValues_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedValues() { - return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; - } - - @Override - public String missingValue() { - return "Kes"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java deleted file mode 100644 index 9da9063..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_Contains_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] expectedPairs() { - return new Pair[]{pair("TNG", "Riker"), pair("DS9", "Kira")}; - } - - @Override - public Map.Entry[] expectedEntries() { - return new Map.Entry[]{pair("TNG", "Riker").toEntry(), pair("DS9", "Kira").toEntry()}; - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } - - @Override - public Map.Entry missingEntry() { - return missingPair().toEntry(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index 6baceb0..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java deleted file mode 100644 index b04c9b6..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java deleted file mode 100644 index 20689c1..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasDistinctSize_Test.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testData) { - return ListMultimapAssert.assertThat(testData); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testData) { - return softAssertions.assertThat(testData); - } - - @Override - public int expectedSize() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java deleted file mode 100644 index 1f9c621..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasKeySatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java deleted file mode 100644 index e7fbec6..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeBetween_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Boundaries withinBoundaries() { - return new Boundaries(25, 50); - } - - @Override - public Boundaries withinBoundariesInclusiveUpper() { - return new Boundaries(25, 38); - } - - @Override - public Boundaries withinBoundariesInclusiveLower() { - return new Boundaries(38, 50); - } - - @Override - public Boundaries belowLowerBoundary() { - return new Boundaries(50, 57); - } - - @Override - public Boundaries aboveUpperBoundary() { - return new Boundaries(25, 32); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index 390ddb9..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat( testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java deleted file mode 100644 index 3ee8457..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java deleted file mode 100644 index d56d8ed..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java deleted file mode 100644 index 1ef2f62..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSizeLessThan_Test.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java deleted file mode 100644 index 4293f89..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasSize_Test.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, ListMultimapAssert> { - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int expectedSize() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java deleted file mode 100644 index fa4c5ae..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_HasValueSatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java deleted file mode 100644 index b308767..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsEmpty_Test.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java deleted file mode 100644 index 8d259d6..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNotEmpty_Test.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class ListMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java deleted file mode 100644 index 86f42d5..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/list/ListMultimapAssert_IsNullOrEmpty_Test.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.list; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; -import org.eclipse.collections.api.factory.Lists; -import org.eclipse.collections.api.multimap.list.ListMultimap; -import org.eclipse.collections.api.multimap.list.MutableListMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class ListMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, ListMultimapAssert> { - @Override - public ListMultimapAssert assertion(ListMultimap testInput) { - return ListMultimapAssert.assertThat(testInput); - } - - @Override - public ListMultimapAssert softAssertion(SoftAssertions softAssertions, ListMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public ListMultimap testInput() { - MutableListMultimap multimap = Multimaps.mutable.list.of(); - multimap.putAll("TOS", Lists.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Lists.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Lists.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Lists.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Lists.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public ListMultimap emptyInput() { - return Multimaps.immutable.list.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java deleted file mode 100644 index 28c442b..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsEntry_Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsEntry_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; -import org.eclipse.collections.impl.tuple.Tuples; - -class SetMultimapAssert_ContainsEntry_Test implements AbstractMultimapAssert_ContainsEntry_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.empty(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair expectedEntry() { - return Tuples.pair("ENT", "Reed"); - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java deleted file mode 100644 index 8c63512..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsKeys_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsKeys_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_ContainsKeys_Test implements AbstractMultimapAssert_ContainsKeys_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedKeys() { - return new String[]{"TOS", "TNG", "DS9"}; - } - - @Override - public String missingKey() { - return "DIS"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java deleted file mode 100644 index 8e1211d..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsOnly_Test.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsOnly_Contract; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_ContainsOnly_Test implements AbstractMultimapAssert_ContainsOnly_Contract, SetMultimapAssert> { - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.put("TNG", "Enterprise"); - multimap.put("DS9", "Deep Space Nine"); - multimap.put("DS9", "Defiant"); - multimap.put("VOY", "Voyager"); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] exactMatchPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] exactMatchEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchMissingPairs() { - return new Pair[]{ - pair("TNG", "Enterprise"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchMissingEntries() { - return new Map.Entry[]{ - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } - - @Override - public Pair[] partialMatchExtraPairs() { - return new Pair[]{ - pair("TOS", "Enterprise"), - pair("TNG", "Enterprise"), - pair("DS9", "Deep Space Nine"), - pair("DS9", "Defiant"), - pair("VOY", "Voyager") - }; - } - - @Override - public Map.Entry[] partialMatchExtraEntries() { - return new Map.Entry[]{ - pair("TOS", "Enterprise").toEntry(), - pair("TNG", "Enterprise").toEntry(), - pair("DS9", "Deep Space Nine").toEntry(), - pair("DS9", "Defiant").toEntry(), - pair("VOY", "Voyager").toEntry() - }; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java deleted file mode 100644 index 7620a42..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_ContainsValues_Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_ContainsValues_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_ContainsValues_Test implements AbstractMultimapAssert_ContainsValues_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public String[] expectedValues() { - return new String[] {"Kirk", "Picard", "Sisko", "Janeway", "Archer"}; - } - - @Override - public String missingValue() { - return "Kes"; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java deleted file mode 100644 index 56c6d7b..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_Contains_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import static org.eclipse.collections.impl.tuple.Tuples.pair; - -import java.util.Map; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_Contains_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.api.tuple.Pair; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_Contains_Test implements AbstractMultimapAssert_Contains_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Pair[] expectedPairs() { - return new Pair[]{pair("TNG", "Picard"), pair("DS9", "Sisko")}; - } - - @Override - public Map.Entry[] expectedEntries() { - return new Map.Entry[]{pair("TNG", "Picard").toEntry(), pair("DS9", "Sisko").toEntry()}; - } - - @Override - public Pair missingPair() { - return pair("VOY", "Kes"); - } - - @Override - public Map.Entry missingEntry() { - return missingPair().toEntry(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index 6b9d2fe..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java deleted file mode 100644 index aa36b71..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasDistinctSizeGreaterThan_Test implements AbstractMultimapAssert_HasDistinctSizeGreaterThan_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 10; - } - - @Override - public int lowerBoundary() { - return 2; - } - - @Override - public int equalsBoundary() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java deleted file mode 100644 index 2ef096c..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasDistinctSize_Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasDistinctSize_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasDistinctSize_Test implements AbstractMultimapAssert_HasDistinctSize_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testData) { - return SetMultimapAssert.assertThat(testData); - } - - @Override - public SetMultimapAssert softAssertion( - SoftAssertions softAssertions, - SetMultimap testData) { - return softAssertions.assertThat(testData); - } - - @Override - public int expectedSize() { - return 5; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java deleted file mode 100644 index d4b189e..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasKeySatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasKeySatisfying_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasKeySatisfying_Test implements AbstractMultimapAssert_HasKeySatisfying_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("DS9"), "key equals DS9"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("DIS"), "value equals DIS"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java deleted file mode 100644 index a313723..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeBetween_Test.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeBetween_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_HasSizeBetween_Test implements AbstractMultimapAssert_HasSizeBetween_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public Boundaries withinBoundaries() { - return new Boundaries(25, 50); - } - - @Override - public Boundaries withinBoundariesInclusiveUpper() { - return new Boundaries(25, 38); - } - - @Override - public Boundaries withinBoundariesInclusiveLower() { - return new Boundaries(38, 50); - } - - @Override - public Boundaries belowLowerBoundary() { - return new Boundaries(50, 57); - } - - @Override - public Boundaries aboveUpperBoundary() { - return new Boundaries(25, 32); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java deleted file mode 100644 index 1f0e557..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_HasSizeGreaterThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeGreaterThanOrEqualTo_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat( testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java deleted file mode 100644 index 0646579..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeGreaterThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeGreaterThan_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_HasSizeGreaterThan_Test implements AbstractMultimapAssert_HasSizeGreaterThan_Contract, SetMultimapAssert> { - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java deleted file mode 100644 index 778e698..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThanOrEqualTo_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasSizeLessThanOrEqualTo_Test implements AbstractMultimapAssert_HasSizeLessThanOrEqualTo_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java deleted file mode 100644 index 932215f..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSizeLessThan_Test.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSizeLessThan_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasSizeLessThan_Test implements AbstractMultimapAssert_HasSizeLessThan_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public int upperBoundary() { - return 50; - } - - @Override - public int lowerBoundary() { - return 5; - } - - @Override - public int equalsBoundary() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java deleted file mode 100644 index 6782025..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasSize_Test.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasSize_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract, SetMultimapAssert> { - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public int expectedSize() { - return 38; - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java deleted file mode 100644 index 2f640b2..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_HasValueSatisfying_Test.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.core.api.Condition; -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_HasValueSatisfying_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_HasValueSatisfying_Test implements AbstractMultimapAssert_HasValueSatisfying_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } - - @Override - public Condition passingCondition() { - return new Condition<>(value -> value.equals("Janeway"), "value equals Janeway"); - } - - @Override - public Condition failingCondition() { - return new Condition<>(value -> value.equals("Kes"), "value equals Kes"); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java deleted file mode 100644 index 256bae3..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsEmpty_Test.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsEmpty_Contract; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_IsEmpty_Test implements AbstractMultimapAssert_IsEmpty_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java deleted file mode 100644 index 7b2026d..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNotEmpty_Test.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNotEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -public class SetMultimapAssert_IsNotEmpty_Test implements AbstractMultimapAssert_IsNotEmpty_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } -} diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java deleted file mode 100644 index e4078d0..0000000 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/set/SetMultimapAssert_IsNullOrEmpty_Test.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * 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 2025-2025 the original author or authors. - */ -package org.assertj.eclipse.collections.api.multimap.set; - -import org.assertj.eclipse.collections.api.SoftAssertions; -import org.assertj.eclipse.collections.api.multimap.AbstractMultimapAssert_IsNullOrEmpty_Contract; -import org.assertj.eclipse.collections.api.multimap.set.SetMultimapAssert; -import org.eclipse.collections.api.factory.Sets; -import org.eclipse.collections.api.multimap.set.SetMultimap; -import org.eclipse.collections.api.multimap.set.MutableSetMultimap; -import org.eclipse.collections.impl.factory.Multimaps; - -class SetMultimapAssert_IsNullOrEmpty_Test implements AbstractMultimapAssert_IsNullOrEmpty_Contract, SetMultimapAssert> { - @Override - public SetMultimapAssert assertion(SetMultimap testInput) { - return SetMultimapAssert.assertThat(testInput); - } - - @Override - public SetMultimapAssert softAssertion(SoftAssertions softAssertions, SetMultimap testInput) { - return softAssertions.assertThat(testInput); - } - - @Override - public SetMultimap testInput() { - MutableSetMultimap multimap = Multimaps.mutable.set.of(); - multimap.putAll("TOS", Sets.immutable.of("Kirk", "Spock", "McCoy", "Scotty", "Uhura", "Sulu", "Chekov")); - multimap.putAll("TNG", Sets.immutable.of("Picard", "Riker", "Data", "Geordi", "Troi", "Crusher", "Worf")); - multimap.putAll("DS9", Sets.immutable.of("Sisko", "Kira", "Obrien", "Dax", "Odo", "Bashir", "Worf", "Quark", "Jake")); - multimap.putAll("VOY", Sets.immutable.of("Janeway", "Chakotay", "Torres", "Paris", "The Doctor", "Tuvok", "Kim", "Seven")); - multimap.putAll("ENT", Sets.immutable.of("Archer", "Trip", "Tpol", "Reed", "Hoshi", "Phlox", "Mayweather")); - return multimap; - } - - @Override - public SetMultimap emptyInput() { - return Multimaps.immutable.set.empty(); - } -} From 201ede363b7d4ac350c831c4ad237856e8ccecb4 Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Wed, 14 May 2025 18:32:24 -0400 Subject: [PATCH 38/39] Tiny cleanup --- .../api/multimap/MultimapAssert_HasKeySatisfying_Test.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java index b36e769..68be703 100644 --- a/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java +++ b/src/test/java/org/assertj/eclipse/collections/api/multimap/MultimapAssert_HasKeySatisfying_Test.java @@ -24,8 +24,8 @@ class MultimapAssert_HasKeySatisfying_Test { - private static final Condition PASSING_CONDITION = new Condition<>(value -> "DS9".equals(value), "key equals DS9"); - private static final Condition FAILING_CONDITION = new Condition<>(value -> "DIS".equals(value), "key equals DIS"); + private static final Condition PASSING_CONDITION = new Condition<>("DS9"::equals, "key equals DS9"); + private static final Condition FAILING_CONDITION = new Condition<>("DIS"::equals, "key equals DIS"); @ParameterizedTest @MethodSource("org.assertj.eclipse.collections.api.multimap.MultimapTestData#nonEmptyMultimaps") From 1600c23228c7e20d148580cdc3b169d25e6a067d Mon Sep 17 00:00:00 2001 From: Matt Bertolini Date: Tue, 24 Jun 2025 06:13:37 -0400 Subject: [PATCH 39/39] Set to use Java 11 for bytecode --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 3258bb6..9fefaee 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ 3.27.3 + 11 13.0.0 5.12.1