Skip to content

Commit 300c3af

Browse files
committed
Add a test case to validate ability to deserialize collections of Doubles
1 parent 8752da7 commit 300c3af

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

components/serialization/json/src/test/java/com/microsoft/kiota/serialization/JsonParseNodeTests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,19 @@ void GetEntityWithUntypedNodesFromJson() throws UnsupportedEncodingException {
172172
}
173173
}
174174
}
175+
176+
@Test
177+
void getCollectionOfPrimitiveDoubleValues() throws UnsupportedEncodingException {
178+
final var initialString = "{\"values\":[1.1,2.2,3.3]}";
179+
final var rawResponse = new ByteArrayInputStream(initialString.getBytes("UTF-8"));
180+
final var parseNode = _parseNodeFactory.getParseNode(contentType, rawResponse);
181+
final var valuesNode = parseNode.getChildNode("values");
182+
assertNotNull(valuesNode);
183+
final var doubles = valuesNode.getCollectionOfPrimitiveValues(Double.class);
184+
assertNotNull(doubles);
185+
assertEquals(3, doubles.size());
186+
assertEquals(1.1, doubles.get(0), 0.000001);
187+
assertEquals(2.2, doubles.get(1), 0.000001);
188+
assertEquals(3.3, doubles.get(2), 0.000001);
189+
}
175190
}

0 commit comments

Comments
 (0)