TCK tests for the First anno#1441
Conversation
There was a problem hiding this comment.
Looks good. While I was reviewing this I thought of a couple of missing negative tests:
- Verify a repository method with the
@Firstannotation and aLimitparameter throws anUnsupportedOperationException - Verify a repository method with the
@Firstannotation and theFirstkeyword (query by method name) throws anUnsupportedOperationException
I think it would also be useful to have one of the repository methods return an array instead of a List since there is an example of that in javadoc.
I did not find this scenario discussed, but should the following repository method work, or be rejected?
@Find
@First
List<Country> leastBy(Sort<Country> sort);We left the default value 1 but still want to return a list. Not something I'd expect a user to WANT to do, but we might want to document what behavior we expect.
Co-authored-by-AI: IBM Bob 1.0.2
…s are found Co-authored-by-AI: IBM Bob 1.0.2
aa9fb2e to
de9ae6c
Compare
|
Thanks Kyle - those are some good comments.
According to the spec, UnsupportedOperationException is one option, but the Data provider alternatively has the option to fail these at build time, so while the above are good ideas to have coverage for, it will be something for Data providers to test on their own.
added in the latest commit
Yes, the spec allows this usage. Although it is not often likely to be useful, I don't see a good reason to go out of our way to add extra language in the spec saying that it must be rejected. I added a test for it. The latest commit also rebased to resolve a merge conflict. |
Adds TCK tests for the
@Firstannotation, covering usage with@Findand@Query, obtaining a single result or multiple results, including cases where there are less results available than the requested First amount.Resolves #532