### Question:
DefaultJsonObject implements JsonObject { @Nullable @Override public Long getAsLong(String name) { if (contains(name)) { return getLong(name).orElse(null); } return null; } DefaultJsonObject(String jsonString); @Override boolean contains(String key); @Override boolean isEmpty(); @Override List<T> getAsList(String name, Class<T> type); @Override List<String> getAsStringList(String name); @Override @Nullable String getAsString(String name); @Override @Nullable Instant getAsInstant(String name); @Nullable @Override Long getAsLong(String name); @Override @Nullable JsonObject getJsonObject(String name); @Override List<JsonObject> getJsonObjects(String name); @Override Map<String, String> getKeyValueMap(); @Override String asJsonString(); @Override String toString();  }### Answer:
@Test public void getAsLong_propertyExists_returnsValue() { cut = createJsonParser(KEY_1, 42); assertThat(cut.getAsLong(KEY_1)).isEqualTo(42); }
@Test public void getAsLong_propertyExistsButIsNotANumber_throwsException() { cut = createJsonParser(KEY_1, "not a number"); assertThatThrownBy(() -> cut.getAsLong(KEY_1)) .isInstanceOf(JsonParsingException.class); }