@Override
    public AWSCredentials getCredentials() {
        Credentials sessionCredentials = credentials.get();
        if (Duration.between(clock.instant(), sessionCredentials.expiry).compareTo(REFRESH_INTERVAL)<0) {
            refresh();
            sessionCredentials = credentials.get();
        }
        return sessionCredentials;
    }
@Test
    void deserializes_credentials() throws IOException {
        Instant originalExpiry = clock.instant().plus(Duration.ofHours(12));
        writeCredentials(credentialsPath, originalExpiry);
        VespaAwsCredentialsProvider credentialsProvider = new VespaAwsCredentialsProvider(credentialsPath, clock);
        AWSCredentials credentials = credentialsProvider.getCredentials();
        assertExpiryEquals(originalExpiry, credentials);
        Assertions.assertEquals("awsAccessKey", credentials.getAWSAccessKeyId());
        Assertions.assertEquals("awsSecretKey", credentials.getAWSSecretKey());
        Assertions.assertEquals("sessionToken", ((VespaAwsCredentialsProvider.Credentials)credentials).getSessionToken());
    }