-
-
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.
Add a verification of fix in jackson-core/#1361
- Loading branch information
1 parent
568066d
commit 78297f0
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/com/fasterxml/jackson/databind/node/JsonPointerCore1361Test.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,36 @@ | ||
package com.fasterxml.jackson.databind.node; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.fasterxml.jackson.core.JsonPointer; | ||
import com.fasterxml.jackson.databind.*; | ||
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
// For [core#1361] (not databind) | ||
public class JsonPointerCore1361Test extends DatabindTestUtil | ||
{ | ||
@Test | ||
public void test1361() throws Exception | ||
{ | ||
ObjectMapper om = newJsonMapper(); | ||
ObjectNode jo = om.createObjectNode(); | ||
ArrayNode nums = om.createArrayNode().add(42).add(-99); | ||
jo.set("num~s",nums); | ||
JsonPointer jp = JsonPointer.compile("/num~s/0"); | ||
|
||
jo.remove("num~s"); | ||
jo.set("nums~",nums); | ||
jp = JsonPointer.compile("/nums~"); | ||
|
||
jo.remove("num~s"); | ||
jo.set("nums~",nums); | ||
jp = JsonPointer.compile("/nums~/0"); | ||
|
||
JsonNode elem0 = jo.at(jp); | ||
assertFalse(elem0.isMissingNode()); | ||
assertEquals(42, elem0.asInt()); | ||
} | ||
} |