@Test
public void testParseStructuredOutput() {

  Resource.Type type = Resource.Type.Task;
  // Test general case
  AmbariManagementController managementController = createMock(AmbariManagementController.class);
  TaskResourceProvider taskResourceProvider = new TaskResourceProvider(
          PropertyHelper.getPropertyIds(type),
          PropertyHelper.getKeyPropertyIds(type), managementController);
  replay(managementController);
  // Check parsing of nested JSON
  Map<?, ?> result = taskResourceProvider
      .parseStructuredOutput("{\"a\":\"b\", \"c\": {\"d\":\"e\",\"f\": [\"g\",\"h\"],\"i\": {\"k\":\"l\"}}}");
  assertEquals(result.size(), 2);
  Map<?, ?> submap = (Map<?, ?>) result.get("c");
  assertEquals(submap.size(), 3);
  List sublist = (List) submap.get("f");
  assertEquals(sublist.size(), 2);
  Map<?, ?> subsubmap = (Map<?, ?>) submap.get("i");
  assertEquals(subsubmap.size(), 1);
  assertEquals(subsubmap.get("k"), "l");
  // Check negative case - invalid JSON
  result = taskResourceProvider.parseStructuredOutput("{\"a\": invalid JSON}");
  assertNull(result);
  // ensure that integers come back as integers
  result = taskResourceProvider.parseStructuredOutput("{\"a\": 5}");
  assertEquals(result.get("a"), 5);
  verify(managementController);
}