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

Comments

Projects
None yet
2 participants
@bartoszwalacik
Member

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

This comment has been minimized.

Member

pszymczyk commented Sep 22, 2017

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

@bartoszwalacik

This comment has been minimized.

Member

bartoszwalacik commented Sep 24, 2017

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

@pszymczyk

This comment has been minimized.

Member

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

This comment has been minimized.

Member

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