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

@PropertyName is ignored in Shadows creation #574

Closed
bartoszwalacik opened this issue Jul 31, 2017 · 4 comments
Closed

@PropertyName is ignored in Shadows creation #574

bartoszwalacik opened this issue Jul 31, 2017 · 4 comments
Labels

Comments

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jul 31, 2017

it causes unexpected nulls in Shadows, reproduction scenario:

class CaseShadowWithPropertyName extends Specification {

    class Entity {
        @Id int id
        @PropertyName("otherField") String someField
    }

    def "should use @PropertyName when creating Shadows"(){
      given:
      def javers = JaversBuilder.javers().build()
      def e = new Entity(id:1, someField: "s")
      javers.commit("author", e)

      when:
      def shadow = javers.findShadows(QueryBuilder.byInstance(e).build()).get(0).get()

      then:
      shadow instanceof Entity
      shadow.id == 1
      shadow.someField == "s"
    }
}
@bartoszwalacik bartoszwalacik added the bug label Jul 31, 2017
@pszymczyk
Copy link
Member

@pszymczyk pszymczyk commented Sep 22, 2017

Is last line in then section correct? Did you mean shadow.someField == "s" or shadow. otherField == "s" ?

@bartoszwalacik
Copy link
Member Author

@bartoszwalacik bartoszwalacik commented Sep 24, 2017

yes, it's correct.
shadow.someField isn't populated

@pszymczyk
Copy link
Member

@pszymczyk pszymczyk commented Oct 3, 2017

The simplest workaround is to annotate field with Gson annotation @SerializedName("otherField") but it's not final solution for sure.

@bartoszwalacik bartoszwalacik added the fixed label Oct 5, 2017
@bartoszwalacik
Copy link
Member Author

@bartoszwalacik bartoszwalacik commented Oct 5, 2017

fix released in 3.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants