Last active
April 19, 2021 02:31
-
-
Save sebhoss/fb41b560672ce3cdd341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DSLContext database = Mockito.mock(DSLContext.class, Mockito.RETURNS_DEEP_STUBS); | |
Mockito.when(database.select(ACTIVITY_TYPE.ID) | |
.from(ACTIVITY_TYPE) | |
.where(ACTIVITY_TYPE.SINGLE_PERSON_USABLE.isTrue()) | |
.fetch(ACTIVITY_TYPE.ID)) | |
.thenReturn(ImmutableList.of(singleActivityTypeId)); | |
Mockito.when(database.select(ACTIVITY_TYPE.ID) | |
.from(ACTIVITY_TYPE) | |
.where(ACTIVITY_TYPE.MULTI_PERSON_USABLE.isTrue()) | |
.fetch(ACTIVITY_TYPE.ID)) | |
.thenReturn(ImmutableList.of(multiActivityTypeId)); |
I like the programmatic deep stubbing:
DSLContext database = Mockito.mock(DSLContext.class, Mockito.RETURNS_DEEP_STUBS);
I like to keep annotations to a minimum. Otherwise you have no idea what your annotation-heavy code does (which is the same reason I hate Spring).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With some
int
s:table is defined as: