Testcontainers Java sample: fix test assertions and wait loop, modernize JDBC/JUnit, and clean up POM#264
Conversation
…ize JDBC/JUnit, and clean up POM
blkgrlcto
left a comment
There was a problem hiding this comment.
Nice modernization pass. The dependency updates, improved README, smarter wait loop, and corrected JUnit assert order all look great.
One small issue in RDS.java:
The connection closing logic in the finally block is redundant and could throw a NullPointerException. Right now it calls c.close(); and then if (c != null) c.close();, which means the first call can fail if c is null, and both are unnecessary.
You can fix this by either:
- Keeping just one null-checked c.close() inside the finally block, or
- Wrapping the Connection in a try-with-resources statement and removing the finally entirely (preferred, since the file already uses try-with-resources for Statement and ResultSet).
Hi @blkgrlcto , Thanks for catching that! The redundant c.close() call was from an earlier revision — the current version only has the null-checked close inside the finally block, so it won’t throw a NullPointerException anymore. Appreciate the thorough review! |
Test stability and correctness
Code hygiene
Dependency updates and cleanups (in pom.xml)
README