Skip to content

Add JUnit 5 tests for SQLDatabaseHandler#2830

Merged
tastybento merged 1 commit intodevelopfrom
worktree-sql-database-handler
Mar 4, 2026
Merged

Add JUnit 5 tests for SQLDatabaseHandler#2830
tastybento merged 1 commit intodevelopfrom
worktree-sql-database-handler

Conversation

@tastybento
Copy link
Member

Summary

  • Adds SQLDatabaseHandlerTest, a new JUnit 5 test class for SQLDatabaseHandler
  • 40 tests covering all public/protected methods and key branches

Coverage

Area What's tested
Constructor / setDataSource Schema creation on boot, rename path, null datasource disables plugin
createSchema SQL exceptions on both schema and rename statements log errors
loadObjects Empty result, valid JSON, multiple rows, null JSON, invalid JSON, SQLException
loadObject Found/not-found, SQLException, useQuotes true/false
saveObject Null, non-DataObject, plugin disabled (sync), plugin enabled (async queue), SQLException
deleteID Queue population, runnable executes correct statement, useQuotes, SQLException
deleteObject Null, non-DataObject, valid object queued
objectExists True/false/no-row, SQLException, useQuotes
close Sets shutdown flag
Async guard Queue runnable abandoned when plugin disabled mid-flight

Test plan

  • ./gradlew test --tests "world.bentobox.bentobox.database.sql.SQLDatabaseHandlerTest" — all 40 tests pass

🤖 Generated with Claude Code

Covers constructor/schema creation, CRUD operations (loadObjects,
loadObject, saveObject, deleteID, deleteObject), objectExists, close,
quote-wrapping behaviour, error logging paths, and the async-guard
branch in store().

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

@tastybento tastybento merged commit 2258657 into develop Mar 4, 2026
3 checks passed
@tastybento tastybento deleted the worktree-sql-database-handler branch March 4, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant