Skip to content

Commit

Permalink
Fix #2980 test (test was faulty, behavior not :) )
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 15, 2020
1 parent 13a7d61 commit c1e8b70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,8 @@ protected void _addExplicitDelegatingCreator(DeserializationContext ctxt,
}

/**
* Helper method called when there is the explicit "is-creator" with mode of "properties-based"
* Helper method called when there is the explicit "is-creator" annotation with mode
* of "properties-based"
*
* @since 2.9.2
*/
Expand Down Expand Up @@ -1072,7 +1073,6 @@ private void _checkImplicitlyNamedConstructors(DeserializationContext ctxt,
}
}


protected boolean _handleSingleArgumentCreator(CreatorCollector creators,
AnnotatedWithParams ctor, boolean isCreator, boolean isVisible)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public RecordWithAltCtor(@JsonProperty("id") int id) {

// [databind#2980]
record RecordWithDelegation(String value) {
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public RecordWithDelegation(String value) {
this.value = "del:"+value;
}
Expand All @@ -31,6 +31,8 @@ public RecordWithDelegation(String value) {
public String getValue() {
return "val:"+value;
}

public String accessValueForTest() { return value; }
}

private final ObjectMapper MAPPER = newJsonMapper();
Expand Down Expand Up @@ -59,7 +61,7 @@ public void testDeserializeWithAltCtor() throws Exception {
public void testDeserializeWithDelegatingCtor() throws Exception {
RecordWithDelegation value = MAPPER.readValue(q("foobar"),
RecordWithDelegation.class);
assertEquals("del:foobar", value.getValue());
assertEquals("del:foobar", value.accessValueForTest());

assertEquals(q("val:del:foobar"), MAPPER.writeValueAsString(value));
}
Expand Down

0 comments on commit c1e8b70

Please sign in to comment.