-
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
Open
mattbertolini
wants to merge
39
commits into
assertj:main
Choose a base branch
from
mattbertolini:feature/multimap-assert
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
5e9d61e
Initial scaffold of AbstractMultimapAssert
mattbertolini a65be44
Add the containsKeys assertion
mattbertolini b8c94ed
Add the contains assertion
mattbertolini 85d661a
Docs
mattbertolini 27cfe5c
Add isNullOrEmpty contract
mattbertolini 4f81348
Add isNotEmpty contract
mattbertolini edc1521
Fix abstract class
mattbertolini 5571114
Add isEmpty assertion
mattbertolini 15a073e
Fix imports
mattbertolini af1950e
Add hasValueSatisfying assertion
mattbertolini c91cb6e
Add hasSizeLessThanOrEqualTo assertion
mattbertolini 553d92c
Add hasKeySatisfying assertion
mattbertolini df7ca8b
Add hasDistinctSize assertion
mattbertolini 7d14c3c
Add hasSize assertion
mattbertolini 67a7351
Add hasSizeLessThan assertion
mattbertolini ab3f467
Add containsOnly assertion
mattbertolini d74a784
Add hasSizeGreaterThan assertion
mattbertolini ee3182c
Tweak condition
mattbertolini 87e4429
Add README
mattbertolini 1c31daa
Add hasSizeGreaterThanOrEqualTo assertion
mattbertolini a774277
Add containsValues assertion
mattbertolini b9777a5
Add license headers
mattbertolini 5819acf
Remove package-info for now. I'll figure out if needed later.
mattbertolini 2f67418
Use list factory method instead of array adapter
mattbertolini d75d93d
Add hasDistinctSizeGreaterThan assertion
mattbertolini 446859f
Add license headers
mattbertolini fbe484a
Adding BDDAssertion support, javadoc
mattbertolini 673bc25
Javadoc and polish
mattbertolini 2694fa0
Add hasSizeBetween assertion
mattbertolini 91e7739
Add license
mattbertolini 8ffca9e
Add hasDistinctSizeGreaterThanOrEqualTo assertion
mattbertolini f4d2061
Clean up unchecked warnings
mattbertolini fce863f
Update scope
mattbertolini 5cac9ce
Fixing javadoc warnings and adding docs
mattbertolini 3f05941
Fix more javadoc warnings
mattbertolini 30bd00f
Polishing
scordio 2c1389f
Simplify test setup by simplifying the Multimap assert.
mattbertolini 5a219c2
Tiny cleanup
mattbertolini e847dc1
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.
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.