@Test
public void refereceToKeyForParent() throws Exception {
Key parentKey = KeyFactory.createKey("Parent", 1);
Key childKey = KeyFactory.createKey(parentKey, "Child", 1);
Reference reference = new Reference();
Path path = new Path();
reference.setPath(path);
Element element = path.addElement();
element.setType("Parent");
element.setId(1);
element = path.addElement();
element.setType("Child");
element.setId(1);
assertThat(DatastoreUtil.referenceToKey(reference), is(childKey));
}