I have a service with a private final hashmap as a cache. People access this service to fetch some information. Everytime a user triggers this the cache might be updated if some time has passed or the user visits the service for the first time.
User A triggers the service and his information is stored within the cache.
User B triggers also the service and his information is stored within the cache as well.
Both users never get the information about other users.
For my unit test I want to check that both information are held within the cache.
I know that I could access the data using reflection in the test.
But are there any other ways accessing the data?
I’m using mockito by the way.
I don’t want to increase the visibility of the field.
I don’t want to expose the information using a package private getter method.
I don’t want to inject the cache using spring bean configuration mechanism.