I have two classes.
- Service.class
- Repository.class
My service is calling cleanup() function which then calls function from repository repository.insertSomething(something)
I need to test if insertSomething has set it's property after the cleanup() has been called.
I have started my test code like this
Service mock = mock(Service.class);
ArgumentCaptor<Repository> argument = ArgumentCaptor.forClass(Repository.class);
verify(mock).cleanup(); <-- have no access to the arguments of the child function and can't use the captor.
As given in example I have no access to the function that is called inside the scope of the cleanup function.
How do i get access to test the arguments of the function which is called by another function.
PS.
I can't call the repository function directly since it loads its argument from a configuration file. And the test should execute given that the cleanup function has been called.
// Child method
@Query("insert into .... where ?1 < ....")
void insertSomething(LocalDate date);