### Question:
DefaultGraphResultsService implements GraphResultsService, InitializingBean { public static String[] parseResourceId(String resourceId) { try { String parent = resourceId.substring(0, resourceId.indexOf(']') + 1); String child = resourceId.substring(resourceId.indexOf(']') + 2); String childType = child.substring(0, child.indexOf('[')); String childName = child.substring(child.indexOf('[') + 1, child.indexOf(']')); return new String[]{parent, childType, childName}; } catch (Throwable e) { log().warn("Illegally formatted resourceId found in DefaultGraphResultsService: " + resourceId, e); return null; } } DefaultGraphResultsService(); @Override GraphResults findResults(String[] resourceIds, String[] reports, long start, long end, String relativeTime); static String[] parseResourceId(String resourceId); @Override void afterPropertiesSet(); ResourceDao getResourceDao(); void setResourceDao(ResourceDao resourceDao); NodeDao getNodeDao(); void setNodeDao(NodeDao nodeDao); GraphDao getGraphDao(); void setGraphDao(GraphDao graphDao); RrdDao getRrdDao(); void setRrdDao(RrdDao rrdDao); void setEventProxy(EventProxy eventProxy);  }### Answer:
@Test public void testParseResourceId() { final String[] values = DefaultGraphResultsService.parseResourceId("node[1].responseTime[127.0.0.1]"); assertEquals("node[1]", values[0]); assertEquals("responseTime", values[1]); assertEquals("127.0.0.1", values[2]); }
@Test public void testUnparsableeResourceId() { final String[] values = DefaultGraphResultsService.parseResourceId("node[1.responseTime[127.0.0.1]"); assertNull(values); }
@Test public void testParseForeignId() { final String[] values = DefaultGraphResultsService.parseResourceId("nodeSource[foreignSource:foreignId].nodeSnmp[]"); assertEquals(3, values.length); assertEquals("nodeSource[foreignSource:foreignId]", values[0]); assertEquals("nodeSnmp", values[1]); assertEquals("", values[2]); }