Example usage for java.time Clock fixed

List of usage examples for java.time Clock fixed

Introduction

In this page you can find the example usage for java.time Clock fixed.

Prototype

public static Clock fixed(Instant fixedInstant, ZoneId zone) 

Source Link

Document

Obtains a clock that always returns the same instant.

Usage

From source file:com.hubrick.vertx.s3.client.AbstractS3ClientTest.java

@Before
public void setUp() throws Exception {
    final S3ClientOptions clientOptions = new S3ClientOptions();
    clientOptions.setDefaultHost(HOSTNAME);
    clientOptions.setDefaultPort(MOCKSERVER_PORT);
    clientOptions.setMaxPoolSize(10);// www  .jav  a  2  s .c  o  m
    clientOptions.setAwsRegion(S3TestCredentials.REGION);
    clientOptions.setAwsServiceName(S3TestCredentials.SERVICE_NAME);
    clientOptions.setHostnameOverride(HOSTNAME);

    augmentClientOptions(clientOptions);

    s3Client = new S3Client(vertx, clientOptions,
            Clock.fixed(Instant.ofEpochSecond(1478782934), ZoneId.of("UTC")));

}

From source file:it.tidalwave.northernwind.frontend.media.impl.DefaultMetadataCacheTest.java

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
private void setTime(final @Nonnull ZonedDateTime dateTime) {
    mockClock = Clock.fixed(dateTime.toInstant(), dateTime.getZone());
    log.info("==== Time set to           {}", ZonedDateTime.now(mockClock));
}