Skip to content

Commit

Permalink
#1170: Add a test about conversion from double to long with SenML.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Dec 7, 2021
1 parent 0cba977 commit eb33697
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,18 @@ public void senml_json_decode_single_resource() {
assertEquals(20.0, resource.getValue());
}

@Test
public void senml_json_decode_single_resource_using_exponantial_notation() {
String payload = "[{\"bn\":\"/3/0/13\",\"v\":1.638435E9}]";
LwM2mResource resource = decoder.decode(payload.getBytes(), ContentFormat.SENML_JSON, new LwM2mPath("/3/0/13"),
model, LwM2mResource.class);

assertNotNull(resource);
assertTrue(!resource.isMultiInstances());
assertEquals(13, resource.getId());
assertEquals(new Date(1638435000000l), resource.getValue());
}

@Test
public void senml_json_decode_multiple_resource() {
StringBuilder payload = new StringBuilder();
Expand Down

0 comments on commit eb33697

Please sign in to comment.