ex172000 commented on code in PR #3026:
URL: https://github.com/apache/iggy/pull/3026#discussion_r2985280910
##########
foreign/java/java-sdk/src/main/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilder.java:
##########
@@ -229,6 +229,9 @@ public AsyncIggyTcpClient build() {
if (connectionPoolSize != null && connectionPoolSize <= 0) {
throw new IggyInvalidArgumentException("Connection pool size
cannot by 0 or negative");
}
+ if (connectionTimeout != null &&
(connectionTimeout.equals(Duration.ZERO) || connectionTimeout.isNegative())) {
Review Comment:
Since we have int casting in another place, do we want to validate that
there's no overflow?
##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/async/tcp/AsyncIggyTcpClientBuilderTest.java:
##########
@@ -137,6 +137,70 @@ void shouldThrowExceptionForZeroPort() {
assertThatThrownBy(builder::build).isInstanceOf(IggyInvalidArgumentException.class);
}
+ @Test
+ void shouldThrowExceptionForNullPort() {
+ // Given: Builder with null port
+ AsyncIggyTcpClientBuilder builder =
+ AsyncIggyTcpClient.builder().host(serverHost()).port(null);
+
+ // When/Then: Building should throw IggyInvalidArgumentException
+
assertThatThrownBy(builder::build).isInstanceOf(IggyInvalidArgumentException.class);
+ }
+
+ @Test
+ void shouldThrowExceptionForZeroConnectionPoolSize() {
+ // Given: Builder with 0 connection pool size
+ AsyncIggyTcpClientBuilder builder =
AsyncIggyTcpClient.builder().connectionPoolSize(0);
+
+ // When/Then: Building should throw IggyInvalidArgumentException
+
assertThatThrownBy(builder::build).isInstanceOf(IggyInvalidArgumentException.class);
+ }
+
+ @Test
+ void shouldThrowExceptionForNegativeConnectionPoolSize() {
+ // Given: Builder with 0 connection pool size
Review Comment:
Maybe we need to update the comments here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]