Skip to content

Commit

Permalink
Update issue 8187
Browse files Browse the repository at this point in the history
Add a (passing) test for parsing floating point numbers from JSON.
  • Loading branch information
jleyba committed Nov 20, 2014
1 parent b5f9916 commit 6280639
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,19 @@ public void testShouldCallFromJsonMethodIfPresent() {
assertEquals("converted", res.convertedValue);
}

// Test for issue 8187
@Test
public void testDecodingResponseWithNumbersInValueObject() {
Response response = new JsonToBeanConverter()
.convert(Response.class, "{\"status\":0,\"value\":{\"width\":96,\"height\":46.19140625}}");

@SuppressWarnings("unchecked")
Map<String, Number> value = (Map<String, Number>) response.getValue();
assertEquals(96, value.get("width").intValue());
assertEquals(46, value.get("height").intValue());
assertEquals(46.19140625, value.get("height").doubleValue(), 0.00001);
}

public static class SimpleBean {

private String value;
Expand Down

0 comments on commit 6280639

Please sign in to comment.