exasol / test-db-builder-java

Java library for creating and cleaning up test database structures and contents for integration tests
MIT License
2 stars 1 forks source link

Implement `AutoClosable` interface in database objects #115

Closed kaklakariada closed 9 months ago

kaklakariada commented 1 year ago

Database objects like Schema already implement drop() method to delete them. To simplify usage, we should let the DatabaseObject interface extend AutoClosable, so that you can use them in try-with-resources blocks. Then they are automatically deleted without explicitly dropping them.

Implementation could be done with minimal effort by adding void close() to DatabaseObject with a default implementation that just calls drop().