File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
core/src/test/java/com/github/jsonldjava/core Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .github .jsonldjava .core ;
2+
3+ import org .junit .Test ;
4+
5+ import java .util .HashMap ;
6+ import java .util .List ;
7+ import java .util .Map ;
8+
9+ import static org .junit .Assert .assertEquals ;
10+
11+ public class DecimalLiteralCanonicalTest {
12+
13+ @ Test
14+ public void testDecimalIsNotCanonicalized () {
15+ double value = 6.5 ;
16+
17+ Map <String , Object > innerMap = new HashMap <>();
18+ innerMap .put ("@value" , value );
19+ innerMap .put ("@type" , "http://www.w3.org/2001/XMLSchema#decimal" );
20+
21+ Map <String , Object > jsonMap = new HashMap <>();
22+ jsonMap .put ("ex:id" , innerMap );
23+
24+ JsonLdApi api = new JsonLdApi (jsonMap , new JsonLdOptions ("" ));
25+ RDFDataset dataset = api .toRDF ();
26+
27+ List <Object > defaultList = (List <Object >) dataset .get ("@default" );
28+ Map <String , Object > tripleMap = (Map <String , Object >) defaultList .get (0 );
29+ Map <String , String > objectMap = (Map <String , String >) tripleMap .get ("object" );
30+
31+ assertEquals ("http://www.w3.org/2001/XMLSchema#decimal" , objectMap .get ("datatype" ));
32+ assertEquals (Double .toString (value ), objectMap .get ("value" ));
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments