### Question:
DefaultJsonObject implements JsonObject { @Override @Nullable public Instant getAsInstant(String name) { if (contains(name)) { return getLong(name) .map(this::convertToInstant) .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 getAsInstant_propertyExistsAndIsEpochTime_returnsInstant() { cut = createJsonParser(KEY_1, "\"" + FIRST_OF_APRIL.getEpochSecond() + "\""); Instant instant = cut.getAsInstant(KEY_1); assertThat(instant).isEqualTo(Instant.from(FIRST_OF_APRIL)); }
@Test public void getAsInstant_propertyExistsAndIsEpochTimeFormattedAsNumber_returnsInstant() { cut = createJsonParser(KEY_1, FIRST_OF_APRIL.getEpochSecond()); Instant instant = cut.getAsInstant(KEY_1); assertThat(instant).isEqualTo(Instant.from(FIRST_OF_APRIL)); }
@Test public void getAsInstant_propertyDoesNotExist_returnsNull() { assertThat(cut.getAsInstant("keyDoesNotExist")).isNull(); }
@Test public void getAsInstant_propertyExistsButIsNotInEpochTime_throwsException() { assertThatThrownBy(() -> cut.getAsInstant(KEY_1)) .isInstanceOf(JsonParsingException.class); }