-
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
base: main
Are you sure you want to change the base?
Start of Multimap Assertions #1
Conversation
Getting the basic structure in place and copying over one assertion (contains)
@mattbertolini thanks for raising this PR! It's of course up to you whether to take care of the Javadoc in this PR or as a second step, so feel free to ignore the failing job. Just let us know how we can help. Personally, I'm happy to provide a general review, although my Eclipse Collections expertise is rather limited. |
@scordio Thank you for all of your work setting this up! I think I'm going to ignore the javadoc in this PR. It's already way too big for my usual comfort. I'd like to land what I have right now to establish the package structure and initial skeleton. |
@scordio I've fixed all of the remaining Javadoc warnings. The build should pass. I could use a review and an approval. I realize its a lot of code. Let me try and describe what I'm trying to do and hopefully that will help guide the review. My general goal is to have these assertions "feel" like AssertJ assertions. I can imagine a world where a user of AssertJ is starting to migrate from the JCF to Eclipse Collections and wants that migration to be as painless as possible. This means keeping the APIs familiar to the core APIs. Having the assertions be more or less drop in replacements seems like a good idea to me. Also, having them map to pre-existing names makes sense if this module is living in the AssertJ organization. The bulk of the implementation of this PR lives in The assertion methods themselves try to leverage as much Eclipse Collections APIs as possible. I am trying to stay away from the existing JCF classes and lean into the power and conciseness of the Eclipse Collections. I've created 3 concrete implementations of this assertion: I've also created the basic For testing, I went with the JUnit 5 test interface pattern with an interface for each assertion method. The interface represents the contract test for that assertion. The interface is then implemented by the three implementations for execution purposes. For example, the // Current pattern of testing
public interface AbstractMultimapAssert_HasSize_Contract {
// ...
}
class ListMultimapAssert_HasSize_Test implements AbstractMultimapAssert_HasSize_Contract {
// ..
} I don't love the pattern. There's quite a bit of duplication involved. But I think having all of the assertions in one test class seems more unwieldy than navigating the test interfaces. I've also thought about using nested test classes that implement the test interfaces. That way There's one "test class" that has all of the contract tests inside of them: // Not done in this PR but I've thought about this
class ListMultimapAssertTest {
@Nested
class HasSize implements AbstractMultimapAssert_HasSize_Contract {
// ...
}
} I'm open to suggestions on testing so I'd be curious to hear everyone's thoughts on it. I want to stress that the Let me know if you have any questions or concerns. 🙂 |
Hi @mattbertolini, many thanks for your work! We're now finalizing the first milestone of AssertJ version 4 – I'll jump on your PR as soon as the milestone is released, which should ideally happen in the upcoming days. |
Hi @mattbertolini, I just wanted to let you know that we haven't forgotten about this PR 🙃 Our M1 release is out, but we have to focus on our documentation for some technical changes, which will also impact this module. However, we would like to proceed with your onboarding to the AssertJ team. Can you please email me and we will take it from there? You should be able to see my address in the git commit history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the good work, @mattbertolini!
I am trying to stay away from the existing JCF classes and lean into the power and conciseness of the Eclipse Collections.
I fully support that 👍 go for the best solution you can leverage in each assertion implementation.
I've created 3 concrete implementations of this assertion:
BagMultimap
,ListMultimap
, andSetMultimap
. Right now they don't do much except leverage their abstract parent class.
I propose postponing the introduction of these concrete types and starting with a single MultimapAssert
(more in my review comment).
For testing, I went with the JUnit 5 test interface pattern with an interface for each assertion method.
I'm an intensive user of that pattern, so I understand the flexibility you're looking for 🙃 However, if my proposal of having a single concrete class is feasible (at least for the time being), you might be able to achieve the same result, perhaps even more concise, with parameterized tests. See for example the testing strategy used in Maps_assertContainsKeys_Test
.
src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java
Outdated
Show resolved
Hide resolved
src/main/java/org/assertj/eclipse/collections/api/multimap/AbstractMultimapAssert.java
Outdated
Show resolved
Hide resolved
src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java
Outdated
Show resolved
Hide resolved
src/main/java/org/assertj/eclipse/collections/api/multimap/bag/BagMultimapAssert.java
Outdated
Show resolved
Hide resolved
Since there is no different between the three different multimap assert types we can collapse them into one assertion type.
I've updated the PR with the suggestions and ready for another round of review 😄 |
This is some of the work started from the disucssion in this Eclipse Collections thread. It begins work on assertions for the Multimap type