Added unit tests for caching behaviour