@Test
public void testPopulateAmbariServerProperties() 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\"}}");
  Map<String, String> props = Collections.singletonMap("a", "b");
  doReturn(props).when(ambariMetaInfo).getAmbariServerProperties();
  cmd.populateAmbariServerInfo(objectNode);
  JsonNode serverProperties = objectNode.get("ambari-server-properties");
  assertNotNull(serverProperties);
  assertEquals("b", serverProperties.iterator().next().getTextValue());
}