Source:
public void setup() throws JsonProcessingException { originalAsyncMethod = TransactionManagers.runAsync; TransactionManagers.runAsync = task -> Awaitility.await().atMost(10, TimeUnit.SECONDS).untilAsserted(task::run); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse().withStatus(200).withBody( ("\"" + UUID.randomUUID().toString() + "\"").getBytes()))); availableServer.stubFor(TIMESTAMP_MAPPING.willReturn(aResponse().withStatus(200).withBody("1"))); availableServer.stubFor(LOCK_MAPPING.willReturn(aResponse().withStatus(200).withBody("2"))); availableServer.stubFor(FEEDBACK_MAPPING.willReturn(aResponse().withStatus(200))); config = mock(AtlasDbConfig.class); when(config.leader()).thenReturn(Optional.empty()); when(config.timestamp()).thenReturn(Optional.empty()); when(config.lock()).thenReturn(Optional.empty()); when(config.timelock()).thenReturn(Optional.empty()); when(config.keyValueService()).thenReturn(new InMemoryAtlasDbConfig()); when(config.initializeAsync()).thenReturn(false); mockAtlasDbRuntimeConfig = mock(AtlasDbRuntimeConfig.class); when(mockAtlasDbRuntimeConfig.timestampClient()).thenReturn(ImmutableTimestampClientConfig.of(false)); when(mockAtlasDbRuntimeConfig.timelockRuntime()).thenReturn(Optional.empty()); when(mockAtlasDbRuntimeConfig.remotingClient()).thenReturn(RemotingClientConfigs.DEFAULT); environment = mock(Consumer.class); invalidator = mock(TimestampStoreInvalidator.class); when(invalidator.backupAndInvalidate()).thenReturn(EMBEDDED_BOUND); availablePort = availableServer.port(); mockClientConfig = getTimelockConfigForServers(ImmutableList.of(getUriForPort(availablePort))); rawRemoteServerConfig = ImmutableServerListConfig.builder() .addServers(getUriForPort(availablePort)) .sslConfiguration(SSL_CONFIGURATION) .build(); }

Target:
public void setup() throws JsonProcessingException { originalAsyncMethod = TransactionManagers.runAsync; TransactionManagers.runAsync = task -> Awaitility.await().atMost(10, TimeUnit.SECONDS).untilAsserted(task::run); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse().withStatus(200).withBody( ("\"" + UUID.randomUUID().toString() + "\"").getBytes()))); availableServer.stubFor(TIMESTAMP_MAPPING.willReturn(aResponse().withStatus(200).withBody("1"))); availableServer.stubFor(LOCK_MAPPING.willReturn(aResponse().withStatus(200).withBody("2"))); availableServer.stubFor(FEEDBACK_MAPPING.willReturn(aResponse().withStatus(204))); config = mock(AtlasDbConfig.class); when(config.leader()).thenReturn(Optional.empty()); when(config.timestamp()).thenReturn(Optional.empty()); when(config.lock()).thenReturn(Optional.empty()); when(config.timelock()).thenReturn(Optional.empty()); when(config.keyValueService()).thenReturn(new InMemoryAtlasDbConfig()); when(config.initializeAsync()).thenReturn(false); mockAtlasDbRuntimeConfig = mock(AtlasDbRuntimeConfig.class); when(mockAtlasDbRuntimeConfig.timestampClient()).thenReturn(ImmutableTimestampClientConfig.of(false)); when(mockAtlasDbRuntimeConfig.timelockRuntime()).thenReturn(Optional.empty()); when(mockAtlasDbRuntimeConfig.remotingClient()).thenReturn(RemotingClientConfigs.DEFAULT); environment = mock(Consumer.class); invalidator = mock(TimestampStoreInvalidator.class); when(invalidator.backupAndInvalidate()).thenReturn(EMBEDDED_BOUND); availablePort = availableServer.port(); mockClientConfig = getTimelockConfigForServers(ImmutableList.of(getUriForPort(availablePort))); rawRemoteServerConfig = ImmutableServerListConfig.builder() .addServers(getUriForPort(availablePort)) .sslConfiguration(SSL_CONFIGURATION) .build(); }