/*
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
 */
package com.montealegreluis.yelpv3;

import java.util.Date;

public class AccessToken {
    private final String accessToken;
    private final String tokenType;
    private final long expiresOn;

    private AccessToken(String accessToken, String tokenType, long expiresOn) {
        this.accessToken = accessToken;
        this.tokenType = tokenType;
        this.expiresOn = expiresOn;
    }

    public static AccessToken fromYELP(String accessToken, String tokenType, long expiresIn) {
        return new AccessToken(
            accessToken, tokenType, new Date().getTime() + expiresIn
        );
    }

    public static AccessToken fromValues(String accessToken, String tokenType, long expiresOn) {
        return new AccessToken(accessToken, tokenType, expiresOn);
    }

    public String accessToken() {
        return accessToken;
    }

    public String tokenType() {
        return tokenType;
    }

    public long expiresOn() {
        return expiresOn;
    }

    public boolean isExpired() {
        return expiresOn < new Date().getTime();
    }
}

@@ -154,17 +154,20 @@
 ava.
-u
 ti
-l.Date
+me.Instant
 ;%0A%0Ap
@@ -655,38 +655,72 @@
 ken,
- tokenType, new Date().getTime
+%0A            tokenType,%0A            Instant.now().getEpochSecond
 () +
@@ -1180,26 +1180,36 @@
 n %3C 
-new Date().getTime
+Instant.now().getEpochSecond
 ();%0A

Use Instant instead of Date in AccessToken