File tree Expand file tree Collapse file tree
src/test/java/com/dashjoin/jsonata Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .dashjoin .jsonata ;
2+
3+ import org .junit .jupiter .api .Assertions ;
4+ import org .junit .jupiter .api .Disabled ;
5+ import org .junit .jupiter .api .Test ;
6+ import com .dashjoin .jsonata .json .Json ;
7+
8+ public class VariableTest {
9+
10+ @ Disabled
11+ @ Test
12+ public void testContextVariable () {
13+ var input = Json .parseJson ("{\n "
14+ + " \" model\" : {\n "
15+ + " \" customer\" : {\n "
16+ + " \" identityDocumentNumber\" : \" ABC123456\" ,\n "
17+ + " \" identityDocumentType\" : \" ID_CARD\" \n "
18+ + " }\n "
19+ + " }\n "
20+ + " }" );
21+ var e = Jsonata .jsonata ("($~>|$|$.model|)@$.\n "
22+ + " ({\n "
23+ + " \" documentIdentityNumber\" : customer.identityDocumentNumber,\n "
24+ + " \" documentIdentityType\" : customer.identityDocumentType\n "
25+ + " })" );
26+ Assertions .assertEquals ("{documentIdentityNumber=ABC123456, documentIdentityType=ID_CARD}" , e .evaluate (input ) + "" );
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments