()
| 8 | /** Tests that we can parse and create JSON using the {@link JsonElement} subset. */ |
| 9 | public final class SubsetTest { |
| 10 | @Test |
| 11 | public void read() { |
| 12 | JsonElement json = JsonParser.parseString("{\"a\":1,\"b\":[2.1, null]}"); |
| 13 | assertThat(json.isJsonObject()).isTrue(); |
| 14 | JsonObject jsonObject = json.getAsJsonObject(); |
| 15 | assertThat(jsonObject.get("a").getAsInt()).isEqualTo(1); |
| 16 | assertThat(jsonObject.get("b").getAsJsonArray().asList()) |
| 17 | .isEqualTo(List.of(new JsonPrimitive(2.1), JsonNull.INSTANCE)); |
| 18 | } |
| 19 | |
| 20 | @Test |
| 21 | public void write() { |
nothing calls this directly
no test coverage detected