@Test public void getDurationUntilExpiryExpiredTest() { dateTimeOfDonation = LocalDateTime.now().minusHours(8); donatedOrgan = new DonatedOrgan(organ, donor, dateTimeOfDonation); assertEquals(Duration.ZERO, donatedOrgan.getDurationUntilExpiry()); }
public Duration getDurationUntilExpiry() { if (organType.getMaxExpiration() == null) { return null; } Duration timeToExpiry = organType.getMaxExpiration().minus(getTimeSinceDonation()); return timeToExpiry.isNegative() || getOverrideReason() != null ? Duration.ZERO : timeToExpiry; }
DonatedOrgan { public Duration getDurationUntilExpiry() { if (organType.getMaxExpiration() == null) { return null; } Duration timeToExpiry = organType.getMaxExpiration().minus(getTimeSinceDonation()); return timeToExpiry.isNegative() || getOverrideReason() != null ? Duration.ZERO : timeToExpiry; } }
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); }
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(); }
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();  }