use of com.datastax.oss.driver.internal.core.connection.ExponentialReconnectionPolicy in project java-driver by datastax.
the class ReconnectionPolicyInfoFinderTest method should_find_an_info_about_exponential_reconnection_policy.
@Test
public void should_find_an_info_about_exponential_reconnection_policy() {
ExponentialReconnectionPolicy exponentialReconnectionPolicy = mock(ExponentialReconnectionPolicy.class);
when(exponentialReconnectionPolicy.getBaseDelayMs()).thenReturn(100L);
when(exponentialReconnectionPolicy.getMaxAttempts()).thenReturn(10L);
when(exponentialReconnectionPolicy.getMaxDelayMs()).thenReturn(200L);
// when
ReconnectionPolicyInfo reconnectionPolicyInfo = new ReconnectionPolicyInfoFinder().getReconnectionPolicyInfo(exponentialReconnectionPolicy, null);
// then
assertThat(reconnectionPolicyInfo.getOptions()).contains(MapEntry.entry("baseDelayMs", 100L));
assertThat(reconnectionPolicyInfo.getOptions()).contains(MapEntry.entry("maxAttempts", 10L));
assertThat(reconnectionPolicyInfo.getOptions()).contains(MapEntry.entry("maxDelayMs", 200L));
assertThat(reconnectionPolicyInfo.getType()).contains("ExponentialReconnectionPolicy");
}
Aggregations