Refactored hierarchical tests into abstract tests

Implement hierachical test for both HashMap and Json storage