ItemFacade implements Item { @Override public final Item getAncestor(int depth) throws RepositoryException { return ItemFacade.ensureBestWrapper(delegate.getAncestor(depth), session); } @SuppressWarnings("WeakerAccess")  ItemFacade(final @NotNull J delegate, final @NotNull SessionFacade<S> session); @SuppressWarnings("WeakerAccess") static @NotNull Item ensureBestWrapper(final @NotNull Item primaryItem, final @NotNull SessionFacade<?> session); @Override final String getPath(); @Override final String getName(); @Override final Item getAncestor(int depth); @Override final Node getParent(); @Override final int getDepth(); @Override final Session getSession(); @Override final boolean isNode(); @Override final boolean isNew(); @Override final boolean isModified(); @Override final boolean isSame(Item otherItem); @Override final void accept(ItemVisitor visitor); @Override final void refresh(boolean keepChanges); @Override final void save(); @Override final void remove();  }
@Test public void testFacadeGetters() throws Exception { new FacadeGetterMapping.Tester<>(Item.class, this::getFacade) .testFacadeGetter(Item.class, ItemFacade.class, item -> item.getAncestor(1)) .testFacadeGetter(Node.class, NodeFacade.class, Item::getParent) .testFacadeGetter(Version.class, VersionFacade.class, Item::getParent) .testFacadeGetter(VersionHistory.class, VersionHistoryFacade.class, Item::getParent); }