DdiActionHistory { @Override public String toString() { return "Action history [" + "status=" + actionStatus + ", messages={" + messages.toString() + "}]"; } @JsonCreator  DdiActionHistory(@JsonProperty("status") final String actionStatus,
            @JsonProperty("messages") List<String> messages); @Override String toString();  }
@Test @Description("Verify the correct deserialization of a model with a additional unknown property") public void shouldDeserializeObjectWithUnknownProperty() throws IOException { String serializedDdiActionHistory = "{\"status\":\"SomeAction\", \"messages\":[\"Some message\"], \"unknownProperty\": \"test\"}"; DdiActionHistory ddiActionHistory = mapper.readValue(serializedDdiActionHistory, DdiActionHistory.class); assertThat(ddiActionHistory.toString()).contains("SomeAction", "Some message"); }
@Test @Description("Verify the correct serialization and deserialization of the model") public void shouldSerializeAndDeserializeObject() throws IOException { String actionStatus = "TestAction"; List<String> messages = Arrays.asList("Action status message 1", "Action status message 2"); DdiActionHistory ddiActionHistory = new DdiActionHistory(actionStatus, messages); String serializedDdiActionHistory = mapper.writeValueAsString(ddiActionHistory); DdiActionHistory deserializedDdiActionHistory = mapper.readValue(serializedDdiActionHistory, DdiActionHistory.class); assertThat(serializedDdiActionHistory).contains(actionStatus, messages.get(0), messages.get(1)); assertThat(deserializedDdiActionHistory.toString()).contains(actionStatus, messages.get(0), messages.get(1)); }