Skip to content

[fix] Make the generated Union equals method symmetric#62

Merged
ellisjoe merged 1 commit into
developfrom
jellis/fixUnionEquals
Sep 3, 2018
Merged

[fix] Make the generated Union equals method symmetric#62
ellisjoe merged 1 commit into
developfrom
jellis/fixUnionEquals

Conversation

@ellisjoe
Copy link
Copy Markdown
Contributor

Before this PR

#61
The generated union equals method is not symmetric with the wrapper equals methods as described in the ticket above.

After this PR

The new generated method is only equal to other Union objects and not the wrapped types.


assertThat(unionTypeStringExample).isEqualTo(stringExample);
assertThat(unionTypeSet).isEqualTo(ImmutableSet.of("item"));
assertThat(unionTypeInt).isEqualTo(5);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we actually keep these tests by make them say isNotEqualTo?

Copy link
Copy Markdown
Contributor

@iamdanfox iamdanfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @markelliot just to double-check we haven't missed an optimization here!

@ellisjoe ellisjoe merged commit 1d94027 into develop Sep 3, 2018
@ellisjoe ellisjoe deleted the jellis/fixUnionEquals branch September 3, 2018 10:04
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 this pull request may close these issues.

3 participants