// Path: here-oauth-client/src/main/java/com/here/account/util/RefreshableResponseProvider.java
// public interface ExpiringResponse {
// 
//     /**
//      * Seconds until expiration, at time of receipt of this object.
//      * 
//      * @return the seconds until expiration
//      */
//     Long getExpiresIn();
// 
//     /**
//      * Current time milliseconds UTC at the time of construction of this object.
//      * In practice, this can generally be considered to be close to the time of receipt of 
//      * the object from the server.
//      * 
//      * @return the start time in milliseconds UTC when this object was received.
//      */
//     Long getStartTimeMilliseconds();
// 
// }
// 
// Path: here-oauth-client/src/main/java/com/here/account/util/RefreshableResponseProvider.java
// public interface ResponseRefresher<T extends ExpiringResponse> {
// 
//   /**
//    * Invoked when on a specified interval to refresh the token.
//    *
//    * @param previous the previous token.  Make sure your implementation 
//    *      can handle the initial case where previous is null.
//    * @return a new token
//    */
//   T refresh(T previous);
// }


import com.here.account.util.RefreshableResponseProvider.ExpiringResponse;
import com.here.account.util.RefreshableResponseProvider.ResponseRefresher;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito;
import java.util.concurrent.ScheduledExecutorService;
import static org.junit.Assert.assertTrue;
package com.here.account.util;




public class RefreshableResponseProviderTest {

    RefreshableResponseProvider<MyExpiringResponse> refreshableResponseProvider;
    
    public class MyExpiringResponse implements ExpiringResponse {
        
        private long startTimeMillis;

        public MyExpiringResponse() {
            this.startTimeMillis = System.currentTimeMillis();
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public Long getExpiresIn() {
            // 10 minutes
            return 10*60L;
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public Long getStartTimeMilliseconds() {
            return startTimeMillis;
        }
        
    }
     Long refreshIntervalMillis;
     MyExpiringResponse initialToken;
// Path: here-oauth-client/src/main/java/com/here/account/util/RefreshableResponseProvider.java
// public interface ExpiringResponse {
// 
//     /**
//      * Seconds until expiration, at time of receipt of this object.
//      * 
//      * @return the seconds until expiration
//      */
//     Long getExpiresIn();
// 
//     /**
//      * Current time milliseconds UTC at the time of construction of this object.
//      * In practice, this can generally be considered to be close to the time of receipt of 
//      * the object from the server.
//      * 
//      * @return the start time in milliseconds UTC when this object was received.
//      */
//     Long getStartTimeMilliseconds();
// 
// }
// 
// Path: here-oauth-client/src/main/java/com/here/account/util/RefreshableResponseProvider.java
// public interface ResponseRefresher<T extends ExpiringResponse> {
// 
//   /**
//    * Invoked when on a specified interval to refresh the token.
//    *
//    * @param previous the previous token.  Make sure your implementation 
//    *      can handle the initial case where previous is null.
//    * @return a new token
//    */
//   T refresh(T previous);
// }


// Path: here-oauth-client/src/test/java/com/here/account/util/RefreshableResponseProviderTest.java
import com.here.account.util.RefreshableResponseProvider.ExpiringResponse;
import com.here.account.util.RefreshableResponseProvider.ResponseRefresher;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito;
import java.util.concurrent.ScheduledExecutorService;
import static org.junit.Assert.assertTrue;

package com.here.account.util;




public class RefreshableResponseProviderTest {

    RefreshableResponseProvider<MyExpiringResponse> refreshableResponseProvider;
    
    public class MyExpiringResponse implements ExpiringResponse {
        
        private long startTimeMillis;

        public MyExpiringResponse() {
            this.startTimeMillis = System.currentTimeMillis();
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public Long getExpiresIn() {
            // 10 minutes
            return 10*60L;
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public Long getStartTimeMilliseconds() {
            return startTimeMillis;
        }
        
    }
     Long refreshIntervalMillis;
     MyExpiringResponse initialToken;
     ResponseRefresher<MyExpiringResponse> refreshTokenFunction;