jOOQ assertj assertions

5 views
Skip to first unread message

Omar Aloraini

unread,
10:42 AM (13 hours ago) 10:42 AM
to jOOQ User Group
I'v been developing my testing style around org.jooq.Record and I have settled on a small assertj extension. I have considered using CSVSoruce or raw strings and loading them using the jOOQ API, but at the end, I settled on a full Java approach for maximum flexibility. 

Curious how other are approaching assertions against the DB or org.jooq.Record.


Example assertions:
assertThat(meeting.resolutions())
.extracting(RESOLUTION.MAJORITY_VOTE.EN, RESOLUTION.MAJORITY_STANDARD_VOTE, RESOLUTION.MAJORITY_VOTE_COUNT.N)
.containsExactly(
row("For", StandardVote.FOR, 100L),
row("Acknowledge", StandardVote.ACKNOWLEDGE, 300L),
row("Option 2", null, 200L)
);

assertThat(meeting.resolutionVotes())
.extracting(RESOLUTION_VOTE.VOTE.EN, RESOLUTION_VOTE.STANDARD_VOTE, RESOLUTION_VOTE.VOTE_COUNT.N, RESOLUTION_VOTE.HAS_MAJORITY)
.containsExactly(
row("For", StandardVote.FOR, 100L, true),
row("Against", StandardVote.AGAINST, 0L, false),
row("Abstain", StandardVote.ABSTAIN, 200L, false),
row("Acknowledge", StandardVote.ACKNOWLEDGE, 300L, true),
row("Option 1", null, 100L, false),
row("Option 2", null, 200L, true),
row("Abstain", StandardVote.ABSTAIN, 0L, false)
);

I using the fields names as extractors.

Gist: https://gist.github.com/ooraini/03520ac699c5cecc4f65b16f3227d303

Alf Lervåg

unread,
12:49 PM (11 hours ago) 12:49 PM
to jooq...@googlegroups.com, jOOQ User Group
This looks interesting. A lot of things between the lines here, and I suspect you’ve tried and discarded things. A longer form post about this subject would be fun. 🤩 
Alf Lervåg

14. feb. 2026 kl. 16:42 skrev Omar Aloraini <alorai...@gmail.com>:

I'v been developing my testing style around org.jooq.Record and I have settled on a small assertj extension. I have considered using CSVSoruce or raw strings and loading them using the jOOQ API, but at the end, I settled on a full Java approach for maximum flexibility. 
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/b24553f7-17c4-4be2-af47-67c1eae8f46en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages