@Test public void getRemainingTimeTest() { LocalDateTime timerTime = LocalDateTime.now().plusMinutes(1); Timer t1 = new Timer(1, timerTime, null, true); assertTrue(t1.getRemainingTime().get(ChronoUnit.SECONDS) <= Duration.ofMillis(60000).getSeconds() && t1.getRemainingTime().get(ChronoUnit.SECONDS) >= Duration.ofMillis(59000).getSeconds()); }
public Duration getRemainingTime() { if (this.active) { LocalDateTime current = LocalDateTime.now(); LocalDateTime future = this.getTimerTime(); return (Duration.ofMillis(current.until(future, ChronoUnit.MILLIS))); } return this.remainingTime; }
Timer extends io.github.amyassist.amy.utility.rest.Entity implements RegistryEntity { public Duration getRemainingTime() { if (this.active) { LocalDateTime current = LocalDateTime.now(); LocalDateTime future = this.getTimerTime(); return (Duration.ofMillis(current.until(future, ChronoUnit.MILLIS))); } return this.remainingTime; } }
Timer extends io.github.amyassist.amy.utility.rest.Entity implements RegistryEntity { public Duration getRemainingTime() { if (this.active) { LocalDateTime current = LocalDateTime.now(); LocalDateTime future = this.getTimerTime(); return (Duration.ofMillis(current.until(future, ChronoUnit.MILLIS))); } return this.remainingTime; } Timer();  Timer(int id, LocalDateTime timerTime, Duration remainingTime, boolean active); }
Timer extends io.github.amyassist.amy.utility.rest.Entity implements RegistryEntity { public Duration getRemainingTime() { if (this.active) { LocalDateTime current = LocalDateTime.now(); LocalDateTime future = this.getTimerTime(); return (Duration.ofMillis(current.until(future, ChronoUnit.MILLIS))); } return this.remainingTime; } Timer();  Timer(int id, LocalDateTime timerTime, Duration remainingTime, boolean active); @Override String toString(); Duration getRemainingTime(); int getId(); void setId(int id); boolean isActive(); void setActive(boolean active); LocalDateTime getTimerTime(); void setTimerTime(LocalDateTime timerTime); void duration(Duration remainingTime); Duration duration(); void setPersistentId(int persistentId); @Override int getPersistentId(); }
Timer extends io.github.amyassist.amy.utility.rest.Entity implements RegistryEntity { public Duration getRemainingTime() { if (this.active) { LocalDateTime current = LocalDateTime.now(); LocalDateTime future = this.getTimerTime(); return (Duration.ofMillis(current.until(future, ChronoUnit.MILLIS))); } return this.remainingTime; } Timer();  Timer(int id, LocalDateTime timerTime, Duration remainingTime, boolean active); @Override String toString(); Duration getRemainingTime(); int getId(); void setId(int id); boolean isActive(); void setActive(boolean active); LocalDateTime getTimerTime(); void setTimerTime(LocalDateTime timerTime); void duration(Duration remainingTime); Duration duration(); void setPersistentId(int persistentId); @Override int getPersistentId();  }