### Question:
DonatedOrgan { public Duration getDurationUntilExpiry() { if (organType.getMaxExpiration() == null) { return null; } Duration timeToExpiry = organType.getMaxExpiration().minus(getTimeSinceDonation()); return timeToExpiry.isNegative() || getOverrideReason() != null ? Duration.ZERO : timeToExpiry; } protected  DonatedOrgan();  DonatedOrgan(Organ organType, Client donor, LocalDateTime dateTimeOfDonation);  DonatedOrgan(Organ organType, Client donor, LocalDateTime dateTimeOfDonation, Long id); static Comparator<DonatedOrgan> getComparator(DonatedOrganSortOptionsEnum sortOption); Organ getOrganType(); Client getDonor(); void setDonor(Client donor); Client getReceiver(); void setReceiver(Client receiver); LocalDateTime getDateTimeOfDonation(); void setDateTimeOfDonation(LocalDateTime dateTimeOfDonation); boolean hasExpired(); boolean hasExpiredNaturally(); Duration getDurationUntilExpiry(); double getProgressDecimal(); double getFullMarker(); Long getId(); void setId(long id); boolean isAvailable(); void setAvailable(boolean available); String getOverrideReason(); @JsonIgnore String getRawOverrideReason(); void manuallyOverride(String overrideReason); void cancelManualOverride(); OrganState getState(); OrganState getState(boolean includeTransplantStatus); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void getDurationUntilExpiryTest() { dateTimeOfDonation = LocalDateTime.now(); donatedOrgan = new DonatedOrgan(organ, donor, dateTimeOfDonation); assertEquals(Duration.ofHours(6).getSeconds(), donatedOrgan.getDurationUntilExpiry().getSeconds(), 1); }
@Test public void getDurationUntilExpiryHasntExpiredTest() { dateTimeOfDonation = LocalDateTime.now().minusHours(2); donatedOrgan = new DonatedOrgan(organ, donor, dateTimeOfDonation); assertEquals(Duration.ofHours(4).getSeconds(), donatedOrgan.getDurationUntilExpiry().getSeconds(), 1); }
@Test public void getDurationUntilExpiryJustExpiredTest() { dateTimeOfDonation = LocalDateTime.now().minusHours(6); donatedOrgan = new DonatedOrgan(organ, donor, dateTimeOfDonation); assertEquals(Duration.ZERO, donatedOrgan.getDurationUntilExpiry()); }
@Test public void getDurationUntilExpiryExpiredTest() { dateTimeOfDonation = LocalDateTime.now().minusHours(8); donatedOrgan = new DonatedOrgan(organ, donor, dateTimeOfDonation); assertEquals(Duration.ZERO, donatedOrgan.getDurationUntilExpiry()); }