-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various Java cleanups #114
Conversation
mimaison
commented
Nov 14, 2024
•
edited
Loading
edited
- Removed usage of deprecated APIs
- Minor refactorings and code simplifications
Signed-off-by: Mickael Maison <[email protected]>
@@ -197,7 +197,7 @@ public String toString() { | |||
*/ | |||
public KafkaVersion latestRelease() { | |||
// at least one release in the json schema is needed | |||
if (this.logicalKafkaVersionEntities == null || this.logicalKafkaVersionEntities.size() < 1) { | |||
if (this.logicalKafkaVersionEntities.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field is final
and initialized when declared so it should never be null
.
* @param ready lambda predicate | ||
*/ | ||
static long waitFor(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) { | ||
static long waitFor(String description, Duration pollInterval, Duration timeout, BooleanSupplier ready) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class is not public
so I assume it's only used by this project and we can change its declaration.
@@ -72,7 +72,7 @@ void testStartContainerWithEmptyConfiguration(final String imageName) { | |||
systemUnderTest.start(); | |||
|
|||
assertThat(systemUnderTest.getBootstrapServers(), is("PLAINTEXT://" | |||
+ systemUnderTest.getContainerIpAddress() + ":" + systemUnderTest.getMappedPort(9092))); | |||
+ systemUnderTest.getHost() + ":" + systemUnderTest.getMappedPort(9092))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getContainerIpAddress()
is deprecated, so switching to getHost()
which is the preferred method now.
@@ -18,8 +18,8 @@ | |||
import static org.hamcrest.CoreMatchers.containsString; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.junit.Assert.assertTrue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the junit 4 dependency brought via testcontainers. We should instead use org.junit.jupiter.api.Assertions
which is junit 5 (the declared dependency in pom.xml).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, please update the description of this PR.
Thanks, I updated the description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming that everything works :) thanks