I'm trying to test the following code using integration tests:
return ((Mono<Object>) joinPoint.proceed()).then(provider.getAuthor().flatMap((author) -> {
Arrays.stream(joinPoint.getArgs())
.forEach(arg -> javers.commitShallowDeleteById(author, InstanceIdDTO.instanceId(arg.toString(), deletedEntity)));
return Mono.empty();
}));
jointPoint.proceeed()
Always returns a Mono<Void>
so that's why i'm using then()
.
When running the app in debug mode if i place a breakpoint inside the flatmap i can see it passes through there, however if i run it in a @SpringBootTest
in no longer passes inside the flatmap.
Test configuration:
@DirtiesContext
@ActiveProfiles("test")
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
Provider:
when(authorProvider.getAuthor()).thenReturn(Mono.just("Author"));