Skip to content

Commit

Permalink
add testcase for issue #1862
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Oct 5, 2023
1 parent b130a1b commit ed7b039
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.alibaba.fastjson2.issues_1800;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONPath;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class Issue1862 {
@Test
public void test() {
String str = "{\"custom\":{},\"uePolicySet\":{\"vendorSpecific-000111\":{\"consumerAttrs\":{\"blobValue\":{\"DataOpt\":\"nidhi123\",\"Entitlements\":[\"ALL-IN\",\"OCS-SY\"],\"BillingPlanCode\":\"5GL03\",\"4GPFO\":\"DPRDTL\",\"5GPFO\":\"5GSPDTL\"}}}}}\n";

String configuredPath = "uePolicySet[\"vendorSpecific-000111\"].consumerAttrs.blobValue";
JSONObject jsonObject = (JSONObject) JSONPath.extract(str, configuredPath);
assertEquals(
"{\"DataOpt\":\"nidhi123\",\"Entitlements\":[\"ALL-IN\",\"OCS-SY\"],\"BillingPlanCode\":\"5GL03\",\"4GPFO\":\"DPRDTL\",\"5GPFO\":\"5GSPDTL\"}",
jsonObject.toString()
);
}
}

0 comments on commit ed7b039

Please sign in to comment.