Polishing.
Delegate calls from deprecated methods to their replacement methods. Simplify tests. See #1494 Original pull request: #1495
This commit is contained in:
@@ -219,12 +219,10 @@ public class QueryOptions {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(o instanceof QueryOptions)) {
|
if (!(o instanceof QueryOptions options)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryOptions options = (QueryOptions) o;
|
|
||||||
|
|
||||||
if (!ObjectUtils.nullSafeEquals(consistencyLevel, options.consistencyLevel)) {
|
if (!ObjectUtils.nullSafeEquals(consistencyLevel, options.consistencyLevel)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -482,12 +480,7 @@ public class QueryOptions {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public QueryOptionsBuilder readTimeout(Duration readTimeout) {
|
public QueryOptionsBuilder readTimeout(Duration readTimeout) {
|
||||||
|
return timeout(readTimeout);
|
||||||
Assert.isTrue(!readTimeout.isNegative(), "ReadTimeout must be greater than equal to zero");
|
|
||||||
|
|
||||||
this.timeout = readTimeout;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,22 +99,7 @@ class QueryOptionsUnitTests {
|
|||||||
@Test // GH-1494
|
@Test // GH-1494
|
||||||
void shouldRejectNegativeDurationTimeoutQueryOptions() {
|
void shouldRejectNegativeDurationTimeoutQueryOptions() {
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(
|
assertThatIllegalArgumentException()
|
||||||
() -> QueryOptions.builder().timeout(Duration.ofSeconds(-1)).build());
|
.isThrownBy(() -> QueryOptions.builder().timeout(Duration.ofSeconds(-1)).build());
|
||||||
}
|
|
||||||
|
|
||||||
@Test // GH-1494
|
|
||||||
void buildZeroDurationReadTimeoutQueryOptions() {
|
|
||||||
|
|
||||||
QueryOptions queryOptions = QueryOptions.builder().readTimeout(Duration.ofSeconds(0)).build();
|
|
||||||
|
|
||||||
assertThat(queryOptions.getReadTimeout()).isEqualTo(Duration.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test // GH-1494
|
|
||||||
void shouldRejectNegativeDurationReadTimeoutQueryOptions() {
|
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(
|
|
||||||
() -> QueryOptions.builder().readTimeout(Duration.ofSeconds(-1)).build());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user