-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix support Queue for JSONPathSegmentIndex.eval, for issue #2602
- Loading branch information
1 parent
0452685
commit 32d0dcc
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
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
24 changes: 24 additions & 0 deletions
24
core/src/test/java/com/alibaba/fastjson2/issues_2600/Issue2602.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,24 @@ | ||
package com.alibaba.fastjson2.issues_2600; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import com.alibaba.fastjson2.TypeReference; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class Issue2602 { | ||
@Test | ||
public void test() { | ||
String json = "[{\"a\":998982405},{\"a\":998992165},{\"$ref\":\"$[1]\"}]"; | ||
ArrayList list = JSON.parseObject(json, new TypeReference<ArrayList>() { | ||
}.getType()); | ||
ConcurrentLinkedQueue queue = JSON.parseObject(json, new TypeReference<ConcurrentLinkedQueue>() { | ||
}.getType()); | ||
assertEquals(list.get(0), queue.poll()); | ||
assertEquals(list.get(1), queue.poll()); | ||
assertEquals(list.get(2), queue.poll()); | ||
} | ||
} |