fix JAVA-5764
This PR is about the JAVA-5764 issue. It changes the encode method by skipping the encode of a property if it's already encoded as the discriminator.
@raffaeleflorio could you include a test case for the issue?
@rozza I've just added the test case. The testDiscriminatorEncodedOnceWhenItIsAlsoAGetter fails without the change because the discriminator will be encoded two times instead of one when encoding a DiscriminatorWithModelGetter object.
@rozza I also added the testDiscriminatorEncodedOnceWhenItIsAlsoAProperty in order to test a getter with the readName as the discriminationKey. It fails without the fix because the same reasons of the aforesaid test.
Hello @rozza @jyemin, what else could I improve about this PR? Thanks
Assigned vbabanin for team dbx-java because rozza is out of office.
Looks good - just going to run the CI again then should be able to merge.
Thanks @raffaeleflorio