FakeClock.Builder


class FakeClock.Builder


A builder for FakeClock instances.

Summary

Public constructors

Creates a new builder for FakeClock instances.

Public functions

FakeClock!

Builds a FakeClock instance.

FakeClock.Builder!

Sets the time the system was booted since the Unix Epoch, in milliseconds.

FakeClock.Builder!

Sets the initial elapsed time since the boot time, in milliseconds.

FakeClock.Builder!

Sets whether the clock should automatically advance the time to the time of the next message that is due to be sent.

FakeClock.Builder!

Sets the maximum time difference between two messages that the fake clock will automatically advance.

Public constructors

Builder

Builder()

Creates a new builder for FakeClock instances.

Public functions

build

fun build(): FakeClock!

Builds a FakeClock instance.

Returns
FakeClock!

The built FakeClock instance.

setBootTimeMs

@CanIgnoreReturnValue
fun setBootTimeMs(bootTimeMs: Long): FakeClock.Builder!

Sets the time the system was booted since the Unix Epoch, in milliseconds.

The default value is 0.

Parameters
bootTimeMs: Long

The time the system was booted since the Unix Epoch, in milliseconds.

Returns
FakeClock.Builder!

This builder.

setInitialTimeMs

@CanIgnoreReturnValue
fun setInitialTimeMs(initialTimeMs: Long): FakeClock.Builder!

Sets the initial elapsed time since the boot time, in milliseconds.

The default value is 0.

Parameters
initialTimeMs: Long

The initial elapsed time since the boot time, in milliseconds.

Returns
FakeClock.Builder!

This builder.

setIsAutoAdvancing

@CanIgnoreReturnValue
fun setIsAutoAdvancing(isAutoAdvancing: Boolean): FakeClock.Builder!

Sets whether the clock should automatically advance the time to the time of the next message that is due to be sent.

The default value is false.

Parameters
isAutoAdvancing: Boolean

Whether the clock should automatically advance the time.

Returns
FakeClock.Builder!

This builder.

setMaxAutoAdvancingTimeDiffMs

@CanIgnoreReturnValue
fun setMaxAutoAdvancingTimeDiffMs(maxAutoAdvancingTimeDiffMs: Long): FakeClock.Builder!

Sets the maximum time difference between two messages that the fake clock will automatically advance.

The default value is DEFAULT_MAX_AUTO_ADVANCING_TIME_DIFF_MS.

Parameters
maxAutoAdvancingTimeDiffMs: Long

The maximum time difference in milliseconds.

Returns
FakeClock.Builder!

This builder.