@Test
public void testPopulateStackHierarchy_noParents() throws Exception {

  File file = mock(File.class);
  String recommendationsArtifactsLifetime = "1w";
  StackAdvisorRunner stackAdvisorRunner = mock(StackAdvisorRunner.class);
  AmbariMetaInfo ambariMetaInfo = mock(AmbariMetaInfo.class);
  StackAdvisorCommand<TestResource> cmd = new TestStackAdvisorCommand(file, recommendationsArtifactsLifetime, "test", 1,
      stackAdvisorRunner, ambariMetaInfo);
  ObjectNode objectNode = (ObjectNode) cmd.mapper.readTree("{\"Versions\": " +
      "{\"stack_name\": \"stack\", \"stack_version\":\"1.0.0\"}}");
  doReturn(Collections.emptyList()).when(ambariMetaInfo).getStackParentVersions("stack", "1.0.0");
  cmd.populateStackHierarchy(objectNode);
  JsonNode stackHierarchy = objectNode.get("Versions").get("stack_hierarchy");
  assertNotNull(stackHierarchy);
  JsonNode stackName = stackHierarchy.get("stack_name");
  assertNotNull(stackName);
  assertEquals("stack", stackName.asText());
  ArrayNode stackVersions = (ArrayNode) stackHierarchy.get("stack_versions");
  assertNotNull(stackVersions);
  assertEquals(0, stackVersions.size());
}