DdiConfigData { public DdiUpdateMode getMode() { return mode; } @JsonCreator  DdiConfigData(@JsonProperty(value = "data") final Map<String, String> data,
            @JsonProperty(value = "mode") final DdiUpdateMode mode); Map<String, String> getData(); DdiUpdateMode getMode(); @Override String toString();  }
@Test @Description("Verify the correct serialization and deserialization of the model") public void shouldSerializeAndDeserializeObject() throws IOException { Map<String, String> data = new HashMap<>(); data.put("test", "data"); DdiConfigData ddiConfigData = new DdiConfigData(data, DdiUpdateMode.REPLACE); String serializedDdiConfigData = mapper.writeValueAsString(ddiConfigData); DdiConfigData deserializedDdiConfigData = mapper.readValue(serializedDdiConfigData, DdiConfigData.class); assertThat(serializedDdiConfigData).contains("test", "data"); assertThat(deserializedDdiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE); }
@Test @Description("Verify the correct deserialization of a model with an additional unknown property") public void shouldDeserializeObjectWithUnknownProperty() throws IOException { String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":\"replace\",\"unknownProperty\":\"test\"}"; DdiConfigData ddiConfigData = mapper.readValue(serializedDdiConfigData, DdiConfigData.class); assertThat(ddiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE); }
@Test @Description("Verify the correct deserialization of a model with removed unused status property") public void shouldDeserializeObjectWithStatusProperty() throws IOException { String serializedDdiConfigData = "{\"id\":123,\"time\":\"20190809T121314\"," + "\"status\":{\"execution\":\"closed\",\"result\":{\"finished\":\"success\",\"progress\":null}," + "\"details\":[]},\"data\":{\"test\":\"data\"},\"mode\":\"replace\"}"; DdiConfigData ddiConfigData = mapper.readValue(serializedDdiConfigData, DdiConfigData.class); assertThat(ddiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE); }