### Question:
TLD { public static Key getNextParentKey(Key docKey) { Text startCF = docKey.getColumnFamily(); if (startCF.find(NULL) != -1) { String cf = startCF.toString(); int index = cf.indexOf('\0'); if (index >= 0) { String uid = cf.substring(index + 1); int index2 = uid.indexOf('\0'); if (index2 >= 0) { uid = uid.substring(0, index2); } if (!uid.isEmpty()) { uid = TLD.parseRootPointerFromId(uid); Text nextDoc = new Text(cf.substring(0, index) + NULL + uid + DEFAULT_SEPARATOR + MAX_UNICODE_STRING); docKey = new Key(docKey.getRow(), nextDoc, docKey.getColumnQualifier(), docKey.getColumnVisibility(), docKey.getTimestamp()); } } } return docKey; } private  TLD(); static ByteSequence parsePointerFromFI(ByteSequence cq); static ByteSequence parseParentPointerFromId(ByteSequence id); static ByteSequence parseFieldAndValueFromFI(ByteSequence cf, ByteSequence cq); static ByteSequence parseFieldAndValueFromTF(ByteSequence cq); static ByteSequence parseRootPointerFromFI(ByteSequence cq); static ByteSequence parseRootPointerFromId(ByteSequence id); static String parseRootPointerFromId(String id); static ByteSequence estimateRootPointerFromId(ByteSequence id); static boolean isRootPointer(ByteSequence id); static ByteSequence fromString(String s); static ArrayList<Integer> instancesOf(int b, ByteSequence sequence); static ArrayList<Integer> instancesOf(int b, ByteSequence sequence, int repeat); static ArrayList<Integer> lastInstancesOf(int b, ByteSequence sequence, int repeat); static Key buildParentKey(Text shard, ByteSequence id, ByteSequence cq, Text cv, long ts); static Key getNextParentKey(Key docKey);  }### Answer:
@Test public void testGetNextParentKey() { Key parentKey = buildEventDataKey(rootId); Key nextParent = TLD.getNextParentKey(parentKey); String cf = datatype + '\u0000' + rootId + '.' + Constants.MAX_UNICODE_STRING; String cq = field + '\u0000' + value; Key expectedKey = new Key(row, cf, cq, cv, 0L); assertEquals(expectedKey, nextParent); parentKey = buildEventDataKey(childId); nextParent = TLD.getNextParentKey(parentKey); assertEquals(expectedKey, nextParent); parentKey = buildEventDataKey(grandchildId); nextParent = TLD.getNextParentKey(parentKey); assertEquals(expectedKey, nextParent); }