-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
62aac6b
commit e984a98
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/test/java/com/fasterxml/jackson/failing/AnySetterForCreator562Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.annotation.*; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class AnySetterForCreator562Test extends DatabindTestUtil | ||
{ | ||
// [databind#562] | ||
static class POJO562 | ||
{ | ||
String a; | ||
|
||
Map<String,Object> stuff; | ||
|
||
@JsonCreator | ||
public POJO562(@JsonProperty("a") String a, | ||
@JsonAnySetter Map<String, Object> | ||
leftovers) { | ||
this.a = a; | ||
stuff = leftovers; | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
// [databind#562] | ||
@Test | ||
public void testAnySetterViaCreator562() throws Exception | ||
{ | ||
POJO562 pojo = MAPPER.readValue(a2q( | ||
"{'a':'value', 'b':42}" | ||
), | ||
POJO562.class); | ||
assertEquals(pojo.a, "value"); | ||
assertEquals(Collections.singletonMap("b", Integer.valueOf(42)), | ||
pojo.stuff); | ||
} | ||
} |