opensearch-project / opensearch-java

Java Client for OpenSearch
Apache License 2.0
122 stars 183 forks source link

[FEATURE] equals/hashCode on API objects #312

Open ginkel opened 1 year ago

ginkel commented 1 year ago

Is your feature request related to a problem?

While developing unit tests for code that makes use of opensearch-java we noticed that the invocations are pretty hard to mock/verify (e.g., using Mockito) as the API objects do not implement equals/hashCode. This causes the effect that it is very hard to verify that a method has been invoked with a certain API object as its argument just uses Object.equals for its equals implementation.

What solution would you like?

Implement equals/hashCode on all API POJOs.

wbeckler commented 1 year ago

This makes sense. Feel free to submit a PR.

ginkel commented 1 year ago

I think as with #298 this doesn't make much sense w/o working code generation, does it?

miguel-vila commented 1 month ago

I see that there is some code generation already, is adding the equals/hashCode methods a possibility now?