Skip to content
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

TCK Tag Collection Test contains() side effect #453

Closed
MattGill98 opened this issue Nov 27, 2020 · 2 comments · Fixed by #488
Closed

TCK Tag Collection Test contains() side effect #453

MattGill98 opened this issue Nov 27, 2020 · 2 comments · Fixed by #488

Comments

@MattGill98
Copy link
Contributor

This line is supposed to check if a list is immutable:

Tag otherTag = createConstructibleInstance(Tag.class);
checkListImmutable(o, OpenAPI::getTags, otherTag);

The test method adds a few default Tag objects beforehand, and this one has no unique data. This means that if the OpenAPI implementation properly implements equals() andhashCode() methods it will actually fail this test, as even if the list is immutable it will contain the previously added Tag (with identical fields).

Is this intended behaviour?

@MikeEdgar
Copy link
Member

@MattGill98 , this is a good catch and I suspect the answer is not straight forward. Something worth discussing for future versions of the specification may be whether the equals and hashCode contract are defined at the MP spec level. I suppose currently it is implicitly defined to be unimplemented for at least some of the model objects.

@aubi
Copy link
Contributor

aubi commented Jul 13, 2021

@MikeEdgar
The Tag class has the "name" field, which will definitely be a part of the equals -- can the field be set in the test? From Tag's javadoc: "It is a REQUIRED property unless this is only a reference to a tag instance."

Tag otherTag  = createConstructibleInstance(Tag.class); 
otherTag.setName("user");
checkListImmutable(o, OpenAPI::getTags, otherTag);

aubi pushed a commit to payara/MicroProfile-TCK-Runners that referenced this issue Jul 13, 2021
Fixed in Payara, ongoing discussion is here:
eclipse/microprofile-open-api#453
Also depend on current Payara 5.2021.5-SNAPSHOT.
aubi added a commit to aubi/Payara that referenced this issue Jul 13, 2021
jGauravGupta pushed a commit to jGauravGupta/Payara that referenced this issue Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants