-
Notifications
You must be signed in to change notification settings - Fork 1
Start of Multimap Assertions #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattbertolini
merged 39 commits into
assertj:main
from
mattbertolini:feature/multimap-assert
Jul 30, 2025
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
aff4cd3
Initial scaffold of AbstractMultimapAssert
mattbertolini b068f42
Add the containsKeys assertion
mattbertolini 543a93b
Add the contains assertion
mattbertolini 5e9264c
Docs
mattbertolini c66a53f
Add isNullOrEmpty contract
mattbertolini 0c0a166
Add isNotEmpty contract
mattbertolini 7ee9782
Fix abstract class
mattbertolini 93112c5
Add isEmpty assertion
mattbertolini 50795f1
Fix imports
mattbertolini 8d487b3
Add hasValueSatisfying assertion
mattbertolini 2d27a39
Add hasSizeLessThanOrEqualTo assertion
mattbertolini f785eae
Add hasKeySatisfying assertion
mattbertolini ffb7aff
Add hasDistinctSize assertion
mattbertolini 87f7871
Add hasSize assertion
mattbertolini 7046be6
Add hasSizeLessThan assertion
mattbertolini 9443a77
Add containsOnly assertion
mattbertolini 908f2e3
Add hasSizeGreaterThan assertion
mattbertolini 686b43c
Tweak condition
mattbertolini 8f9404a
Add README
mattbertolini 8429c53
Add hasSizeGreaterThanOrEqualTo assertion
mattbertolini 292c93f
Add containsValues assertion
mattbertolini aab8f70
Add license headers
mattbertolini 4d74387
Remove package-info for now. I'll figure out if needed later.
mattbertolini 7392027
Use list factory method instead of array adapter
mattbertolini d41236d
Add hasDistinctSizeGreaterThan assertion
mattbertolini bed1e36
Add license headers
mattbertolini 2aa7c34
Adding BDDAssertion support, javadoc
mattbertolini 76d46e5
Javadoc and polish
mattbertolini 090d64a
Add hasSizeBetween assertion
mattbertolini 24469f5
Add license
mattbertolini 588bab3
Add hasDistinctSizeGreaterThanOrEqualTo assertion
mattbertolini 5f2f291
Clean up unchecked warnings
mattbertolini 6d40019
Update scope
mattbertolini acfd7d7
Fixing javadoc warnings and adding docs
mattbertolini e090ddd
Fix more javadoc warnings
mattbertolini 0511918
Polishing
scordio 77a24df
Simplify test setup by simplifying the Multimap assert.
mattbertolini 201ede3
Tiny cleanup
mattbertolini 1600c23
Set to use Java 11 for bytecode
mattbertolini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # AssertJ Eclipse Collections [](https://www.repostatus.org/#wip) | ||
|
|
||
| [](https://github.com/assertj/assertj/actions/workflows/main.yml?query=branch%3Amain) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/org/assertj/eclipse/collections/api/Assertions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * 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.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 | ||
| * for a type-specific assertion object. | ||
| */ | ||
| @CheckReturnValue | ||
| public class Assertions { | ||
| /** | ||
| * Creates a new {@link Assertions}. | ||
| */ | ||
| protected Assertions() { | ||
| // Do nothing | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new instance of {@link MultimapAssert}. | ||
| * | ||
| * @param actual the actual value. | ||
| * @return the created assertion object. | ||
| * @param <KEY> The type of keys in the BagMultimap | ||
| * @param <VALUE> The type of values in the BagMultimap | ||
| */ | ||
| public static <KEY, VALUE> MultimapAssert<KEY, VALUE> assertThat(Multimap<KEY, VALUE> actual) { | ||
| return new MultimapAssert<>(actual); | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
src/main/java/org/assertj/eclipse/collections/api/BDDAssertions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * 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.MultimapAssert; | ||
| import org.eclipse.collections.api.multimap.Multimap; | ||
|
|
||
| /** | ||
| * 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 { | ||
| /** | ||
| * Creates a new <code>{@link BDDAssertions}</code>. | ||
| */ | ||
| protected BDDAssertions() { | ||
| // Do nothing | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new instance of {@link MultimapAssert}. | ||
| * | ||
| * @param actual the actual value. | ||
| * @return the created assertion object. | ||
| * @param <KEY> The type of keys in the BagMultimap | ||
| * @param <VALUE> The type of values in the BagMultimap | ||
| */ | ||
| public static <KEY, VALUE> MultimapAssert<KEY, VALUE> then(Multimap<KEY, VALUE> actual) { | ||
| return assertThat(actual); | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
...in/java/org/assertj/eclipse/collections/api/EclipseCollectionsSoftAssertionsProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * 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; | ||
| import org.assertj.core.util.CheckReturnValue; | ||
| import org.assertj.eclipse.collections.api.multimap.MultimapAssert; | ||
| import org.eclipse.collections.api.multimap.Multimap; | ||
|
|
||
| /** | ||
| * Soft assertions implementations for Eclipse Collections types. | ||
| */ | ||
| @CheckReturnValue | ||
| public interface EclipseCollectionsSoftAssertionsProvider extends SoftAssertionsProvider { | ||
| /** | ||
| * Creates a new, proxied instance of a {@link MultimapAssert} | ||
| * | ||
| * @param actual the path | ||
| * @return the created assertion object | ||
| * @param <KEY> The type of keys in the actual BagMultimap | ||
| * @param <VALUE> The type of values in the actual BagMultimap | ||
| */ | ||
| @SuppressWarnings("unchecked") | ||
| default <KEY, VALUE> MultimapAssert<KEY, VALUE> assertThat(Multimap<KEY, VALUE> actual) { | ||
| return this.proxy(MultimapAssert.class, Multimap.class, actual); | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
src/main/java/org/assertj/eclipse/collections/api/SoftAssertions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.api; | ||
|
|
||
| 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<SoftAssertions> softly) { | ||
| SoftAssertionsProvider.assertSoftly(SoftAssertions.class, softly); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.