### Question:
TokenExpirationInfoBO { public boolean isPartLifetimePassed(double part) { Duration tokenDurationAllowedByIdentityProvider = getTokenExpirationDuration(); Duration actualTokenDuration = getTokenLifetimeDuration(); return tokenDurationAllowedByIdentityProvider.toMillis() * 1.0 * part < actualTokenDuration.toMillis(); } TokenExpirationInfoBO();  TokenExpirationInfoBO(long issuedAt, long expiration); Duration getTokenExpirationDuration(); Duration getTokenLifetimeDuration(); boolean isDurationPassed(Duration duration); boolean isDurationPassed(Duration duration, Instant comparing); boolean isExpired(); boolean isPartLifetimePassed(double part); Instant getIssuedAt(); void setIssuedAt(Instant issuedAt); Instant getExpiration(); void setExpiration(Instant expiration); @Override String toString();  }### Answer:
@Test void isPartLifetimePassed30Percent() { Instant now = Instant.now(); long issueToken = now.minusSeconds(300).toEpochMilli() / 1000; long expiration = now.plusSeconds(700).toEpochMilli() /1000; TokenExpirationInfoBO token = new TokenExpirationInfoBO(issueToken, expiration); assertThat(token.isPartLifetimePassed(0.25), is(true)); assertThat(token.isPartLifetimePassed(0.5), is(false)); assertThat(token.isPartLifetimePassed(0.75), is(false)); }
@Test void isPartLifetimePassed60Percent() { Instant now = Instant.now(); long issueToken = now.minusSeconds(600).toEpochMilli() / 1000; long expiration = now.plusSeconds(400).toEpochMilli() /1000; TokenExpirationInfoBO token = new TokenExpirationInfoBO(issueToken, expiration); assertThat(token.isPartLifetimePassed(0.25), is(true)); assertThat(token.isPartLifetimePassed(0.5), is(true)); assertThat(token.isPartLifetimePassed(0.75), is(false)); }
@Test void isPartLifetimePassed80Percent() { Instant now = Instant.now(); long issueToken = now.minusSeconds(800).toEpochMilli() / 1000; long expiration = now.plusSeconds(200).toEpochMilli() /1000; TokenExpirationInfoBO token = new TokenExpirationInfoBO(issueToken, expiration); assertThat(token.isPartLifetimePassed(0.25), is(true)); assertThat(token.isPartLifetimePassed(0.5), is(true)); assertThat(token.isPartLifetimePassed(0.75), is(true)); }