void () { getTypeChooserManager().registerTypeChooser(MyAbstractElement.class, new MyTypeChooser()); try { final MyElement element = createElement(""); final MyAbstractElement abstractChild = element.getAbstractChild(); final MyElement child239 = abstractChild.getChild239(); assertSame(child239, child239.getParentOfType(MyElement.class, false)); assertSame(abstractChild, child239.getParentOfType(MyElement.class, true)); assertSame(abstractChild, child239.getParentOfType(MyAbstractElement.class, true)); assertSame(DomUtil.getFileElement(element), child239.getParentOfType(DomFileElement.class, false)); assertSame(DomUtil.getFileElement(element), DomUtil.getFileElement(element).getParentOfType(DomFileElement.class, false)); assertNull(DomUtil.getFileElement(element).getParentOfType(DomFileElement.class, true)); } finally { getTypeChooserManager().unregisterTypeChooser(MyAbstractElement.class); } }