Testcontainers-java: ConnectionWrapper#rollback(Savepoint) delegates to wrong method

Created on 24 Sep 2019  路  2Comments  路  Source: testcontainers/testcontainers-java

ConnectionWrapper#rollback(Savepoint) delegates to Connection#rollback() instead of Connection#rollback(Savepoint): https://github.com/testcontainers/testcontainers-java/blob/b6a5248365acb240cd6f6c7d3c1ae38c6c5b3ed7/modules/jdbc/src/main/java/org/testcontainers/jdbc/ConnectionWrapper.java#L165-L168

good first issue hacktoberfest modulejdbc resolutioawaiting-release typbug

Most helpful comment

Hi, I would like to take this up

All 2 comments

Hi @knutwannheden,

Thanks for spotting it! This sounds like a perfect task for contribution :)

In case somebody wants to work on it, I recommend the following:

  1. create ConnectionDelegate class, accept Connection as an argument and mark it with Lombok's @Delegate
  2. extend ConnectionWrapper from ConnectionDelegate and override close to trigger the callback

This way we ensure that all methods are delegated correctly.

FYI this approach is also described in the following blog post:
https://bsideup.github.io/posts/easy_java_delegates/

Hi, I would like to take this up

Was this page helpful?
0 / 5 - 0 ratings