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

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jooq-user/b24553f7-17c4-4be2-af47-67c1eae8f46en%40googlegroups.com.

Reply via email to