refactor tests to use stubs with expectations
refactor CacheTest for code golf