### Question:
ResourceUtil { static String extractSimpleFieldFromZNRecord(String recordStr, String key) { int idx = recordStr.indexOf(key); if (idx != -1) { idx = recordStr.indexOf('"', idx + key.length() + 1); if (idx != -1) { int idx2 = recordStr.indexOf('"', idx + 1); if (idx2 != -1) { return recordStr.substring(idx + 1, idx2); } } } return null; }  static String getAttributeFromRequest(Request r, RequestKey key); static ZkClient getAttributeFromCtx(Context ctx, ContextKey key); static String getYamlParameters(Form form, YamlParamKey key); static String readZkAsBytes(ZkClient zkclient, PropertyKey propertyKey); static Map<String, String> readZkChildrenAsBytesMap(ZkClient zkclient, PropertyKey propertyKey);  }### Answer:
@Test public void testReadSimpleFieldWithoutDer() throws Exception { IdealState idealState = new IdealState("MyDB"); idealState.setInstanceGroupTag("MyTag"); String recordStr = ClusterRepresentationUtil.ZNRecordToJson(idealState.getRecord()); String value = ResourceUtil.extractSimpleFieldFromZNRecord(recordStr, IdealState.IdealStateProperty.INSTANCE_GROUP_TAG.toString()); Assert.assertEquals(value, "MyTag"); }