Added unit tests for hierarchy validity.